Neos\ContentRepository\Domain\Service\Context::getRootNode PHP Method

getRootNode() public method

Convenience method returns the root node for this context workspace.
public getRootNode ( ) : Neos\ContentRepository\Domain\Model\NodeInterface
return Neos\ContentRepository\Domain\Model\NodeInterface
    public function getRootNode()
    {
        return $this->getNode('/');
    }

Usage Example

 /**
  * @test
  */
 public function getChildNodesWithNodeTypeFilterWorks()
 {
     $documentNodeType = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Document');
     $headlineNodeType = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Headline');
     $imageNodeType = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Image');
     $node = $this->context->getRootNode()->createNode('node-with-child-node', $documentNodeType);
     $node->createNode('headline', $headlineNodeType);
     $node->createNode('text', $imageNodeType);
     $this->assertCount(1, $node->getChildNodes('Neos.ContentRepository.Testing:Headline'));
 }
All Usage Examples Of Neos\ContentRepository\Domain\Service\Context::getRootNode