Creates and persists a node from the given $nodeTemplate as child node
public createNodeDataFromTemplate ( |
||
$nodeTemplate | ||
$nodeName | string | name of the new node. If not specified the name of the nodeTemplate will be used. |
$workspace | ||
$dimensions | array | |
return | the freshly generated node |
/** * Creates and persists a node from the given $nodeTemplate as child node * * @param NodeTemplate $nodeTemplate * @param string $nodeName name of the new node. If not specified the name of the nodeTemplate will be used. * @return NodeInterface the freshly generated node * @api */ public function createNodeFromTemplate(NodeTemplate $nodeTemplate, $nodeName = null) { $nodeData = $this->nodeData->createNodeDataFromTemplate($nodeTemplate, $nodeName, $this->context->getWorkspace(), $this->context->getDimensions()); $node = $this->nodeFactory->createFromNodeData($nodeData, $this->context); $this->context->getFirstLevelNodeCache()->flush(); $this->emitNodeAdded($node); return $node; }