/** * Creates and persists a node from the given $nodeTemplate as child node * * @param \TYPO3\TYPO3CR\Domain\Model\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; }