Neos\ContentRepository\Domain\Model\NodeInterface::createNode PHP Метод

createNode() публичный Метод

Creates, adds and returns a child node of this node. Also sets default properties and creates default subnodes.
public createNode ( string $name, NodeType $nodeType = null, string $identifier = null ) : Node
$name string Name of the new node
$nodeType NodeType Node type of the new node (optional)
$identifier string The identifier of the node, unique within the workspace, optional(!)
Результат Node
    public function createNode($name, NodeType $nodeType = null, $identifier = null);

Usage Example

 /**
  * @test
  */
 public function inheritanceBasedConstraintsWork()
 {
     $testingNodeTypeWithSubnodes = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeTypeWithSubnodes');
     $testingNodeTypeThatInheritsFromDocumentType = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Page');
     $nodeWithChildNode = $this->rootNode->createNode('node-with-child-node', $testingNodeTypeWithSubnodes);
     $nodeWithChildNode->createNode('page', $testingNodeTypeThatInheritsFromDocumentType);
     $this->assertCount(2, $nodeWithChildNode->getChildNodes());
 }
All Usage Examples Of Neos\ContentRepository\Domain\Model\NodeInterface::createNode