Neos.ContentRepository/Classes/Domain/Model/Node.php
public function createSingleNode($name, NodeType $nodeType = null, $identifier = null): NodeInterface
    {
        if ($nodeType !== null && !$this->willChildNodeBeAutoCreated($name) && !$this->isNodeTypeAllowedAsChildNode($nodeType)) {
            throw new NodeConstraintException('Cannot create new node "' . $name . '" of Type "' . $nodeType->getName() . '" in ' . $this->__toString(), 1400782413);
        }

        $dimensions = $this->context->getTargetDimensionValues();

        $nodeData = $this->nodeData->createSingleNodeData($name, $nodeType, $identifier, $this->context->getWorkspace(), $dimensions);
        $node = $this->nodeFactory->createFromNodeData($nodeData, $this->context);

        $this->context->getFirstLevelNodeCache()->flush();
        $this->emitNodeAdded($node);

        return $node;
    }
public function createSingleNode($name, NodeType $nodeType = null, $identifier = null): NodeInterface
    {
        if ($nodeType !== null && !$this->willChildNodeBeAutoCreated($name) && !$this->isNodeTypeAllowedAsChildNode($nodeType)) {
            throw new NodeConstraintException('Cannot create new node "' . $name . '" of Type "' . $nodeType->getName() . '" in ' . $this->__toString(), 1400782413);
        }

        $dimensions = $this->context->getTargetDimensionValues();

        $nodeData = $this->nodeData->createSingleNodeData($name, $nodeType, $identifier, $this->context->getWorkspace(), $dimensions);
        $node = $this->nodeFactory->createFromNodeData($nodeData, $this->context);

        $this->context->getFirstLevelNodeCache()->flush();
        $this->emitNodeAdded($node);

        return $node;
    }
public function createSingleNode ( $ name , NodeType $ nodeType = null , $ identifier = null ) : NodeInterface { if ( $ nodeType !== null && ! $ this -> willChildNodeBeAutoCreated ( $ name ) && ! $ this -> isNodeTypeAllowedAsChildNode ( $ nodeType ) ) { throw new NodeConstraintException ( 'Cannot create new node "' . $ name . '" of Type "' . $ nodeType -> getName ( ) . '" in ' . $ this -> __toString ( ) , 1400782413 ) ; } $ dimensions = $ this -> context -> getTargetDimensionValues ( ) ; $ nodeData = $ this -> nodeData -> createSingleNodeData ( $ name , $ nodeType , $ identifier , $ this -> context -> getWorkspace ( ) , $ dimensions ) ; $ node = $ this -> nodeFactory -> createFromNodeData ( $ nodeData , $ this -> context ) ; $ this -> context -> getFirstLevelNodeCache ( ) -> flush ( ) ; $ this -> emitNodeAdded ( $ node ) ; return $ node ; }
Creates, adds and returns a child node of this node, without setting default
properties or creating subnodes. Only used internally.

For internal use only!
TODO: New SiteImportService uses createNode() and DQL. When we drop the LegagcySiteImportService we can change this to protected.

@param string $name Name of the new node
@param NodeType $nodeType Node type of the new node (optional)
@param string $identifier The identifier of the node, unique within the workspace, optional(!)
@return NodeInterface
@throws NodeConfigurationException
@throws NodeConstraintException
@throws NodeException
@throws NodeExistsException
@throws NodeTypeNotFoundException
Creates adds and returns a child node of this node without setting default properties or creating subnodes . Only used internally .