getWorkspace() public method

Returns the workspace this node is contained in
public getWorkspace ( ) : Workspace
return Workspace
コード例 #1
0
 /**
  * @test
  */
 public function removedNodeWithoutExistingTargetNodeDataWillBeRemovedWhenPublished()
 {
     $homepageNode = $this->rootNode->createNode('homepage');
     $homepageNode->remove();
     $this->rootNode->getWorkspace()->publish($this->liveWorkspace);
     $this->saveNodesAndTearDownRootNodeAndRepository();
     $this->setUpRootNodeAndRepository();
     $liveContext = $this->contextFactory->create(array('workspaceName' => 'live', 'removedContentShown' => true));
     $liveRootNode = $liveContext->getRootNode();
     $liveHomepageNode = $liveRootNode->getNode('homepage');
     $this->assertTrue($liveHomepageNode === null, 'A removed node should be removed after publishing, but it was still found');
 }
コード例 #2
0
ファイル: NodeController.php プロジェクト: neos/neos
 /**
  * Updates the specified node.
  *
  * Returns the following data:
  *
  * - the (possibly changed) workspace name of the node
  * - the URI of the closest document node. If $node is a document node (f.e. a Page), the own URI is returned.
  *   This is important to handle renames of nodes correctly.
  *
  * Note: We do not call $nodeDataRepository->update() here, as ContentRepository has a stateful API for now.
  *       We need to call persistAll() in order to return the nextUri. We can't persist only the nodes in NodeDataRepository
  *       because they might be connected to images / resources which need to be updated at the same time.
  *
  * @param Node $node The node to be updated
  * @return void
  */
 public function updateAction(Node $node)
 {
     if ($this->request->getHttpRequest()->isMethodSafe() === false) {
         $this->persistenceManager->persistAll();
     }
     $q = new FlowQuery(array($node));
     $closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
     $nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', array('node' => $closestDocumentNode), 'Frontend\\Node', 'Neos.Neos');
     $this->view->assign('value', array('data' => array('workspaceNameOfNode' => $node->getWorkspace()->getName(), 'labelOfNode' => $node->getLabel(), 'nextUri' => $nextUri), 'success' => true));
 }