getContext() public method

Returns the context this node operates in.
public getContext ( ) : Context
return Neos\ContentRepository\Domain\Service\Context
コード例 #1
0
 /**
  * @test
  */
 public function nodeFromLiveWorkspaceMovedInUserWorkspaceRetainsShadowNodeInGroupWorkspace()
 {
     $liveContext = $this->contextFactory->create([]);
     $liveContext->getRootNode()->createNode('foo')->createNode('bar')->createNode('baz');
     $this->persistenceManager->persistAll();
     $this->rootNode->getNode('foo/bar/baz')->moveInto($this->rootNode->getNode('foo'));
     $this->persistenceManager->persistAll();
     $this->rootNode->getContext()->getWorkspace()->publish($this->groupWorkspace);
     $this->persistenceManager->persistAll();
     $groupContext = $this->contextFactory->create(['workspaceName' => $this->currentGroupWorkspace]);
     $movedBazNode = $groupContext->getRootNode()->getNode('foo')->getNode('baz');
     $this->assertInstanceOf(NodeInterface::class, $movedBazNode);
     $shadowNode = $this->nodeDataRepository->findShadowNodeByPath('/foo/bar/baz', $this->groupWorkspace, $groupContext->getDimensions());
     $this->assertInstanceOf(NodeData::class, $shadowNode);
     $this->assertNotNull($shadowNode->getMovedTo());
     $this->assertTrue($shadowNode->isRemoved());
 }
コード例 #2
0
ファイル: NodeController.php プロジェクト: neos/neos
 /**
  * Return child nodes of specified node for usage in a TreeLoader based on filter
  *
  * @param Node $node The node to find child nodes for
  * @param string $term
  * @param string $nodeType
  * @return void
  */
 public function filterChildNodesForTreeAction(Node $node, $term, $nodeType)
 {
     $nodeTypes = strlen($nodeType) > 0 ? array($nodeType) : array_keys($this->nodeTypeManager->getSubNodeTypes('Neos.Neos:Document', false));
     $context = $node->getContext();
     if ($term !== '') {
         $nodes = $this->nodeSearchService->findByProperties($term, $nodeTypes, $context, $node);
     } else {
         $nodes = array();
         $nodeDataRecords = $this->nodeDataRepository->findByParentAndNodeTypeRecursively($node->getPath(), implode(',', $nodeTypes), $context->getWorkspace(), $context->getDimensions());
         foreach ($nodeDataRecords as $nodeData) {
             $matchedNode = $this->nodeFactory->createFromNodeData($nodeData, $context);
             if ($matchedNode !== null) {
                 $nodes[$matchedNode->getPath()] = $matchedNode;
             }
         }
     }
     $this->view->assignFilteredChildNodes($node, $nodes);
 }