protected function createNode(NodeInterface $parent)
{
$nodeType = $this->getNodeType();
$initialProperties = $this->getInitialProperties();
$name = $this->getName() ?: $this->nodeService->generateUniqueNodeName($parent->getPath());
//
// If we're about to create a document, check for the presence of the uriPathSegment property first
// and create it, if it's missing
//
if ($nodeType->isOfType('TYPO3.Neos:Document') && !isset($initialProperties['uriPathSegment'])) {
if (!isset($initialProperties['title'])) {
throw new \IllegalArgumentException('You must either provide a title or a uriPathSegment in order to create a document.', 1452103891);
}
$initialProperties['uriPathSegment'] = NodeUtility::renderValidNodeName($initialProperties['title']);
}
$node = $parent->createNode($name, $nodeType);
foreach ($initialProperties as $key => $value) {
$node->setProperty($key, $value);
}
return $node;
}