diff --git a/Classes/Service/HierarchyService.php b/Classes/Service/HierarchyService.php index 5210036..6af608f 100644 --- a/Classes/Service/HierarchyService.php +++ b/Classes/Service/HierarchyService.php @@ -94,6 +94,7 @@ public function buildHierarchy(array $hierarchyConfiguration, array $context, bo * @return NodeInterface The created or found hierarchy node * @throws ArchivistConfigurationException * @throws NodeTypeNotFoundException + * @throws \Neos\ContentRepository\Exception\NodeExistsException * @throws \Neos\Eel\Exception */ protected function buildHierarchyLevel(NodeInterface $parentNode, array $hierarchyLevelConfiguration, array $context, bool $publishHierarchy): NodeInterface @@ -127,16 +128,16 @@ protected function buildHierarchyLevel(NodeInterface $parentNode, array $hierarc unset($hierarchyLevelConfiguration['properties']['name']); } + $hierarchyLevelNode = $parentNode->createNode($hierarchyLevelNodeTemplate->getName(), $hierarchyLevelNodeTemplate->getNodeType()); + if (isset($hierarchyLevelConfiguration['properties'])) { - $this->applyProperties($hierarchyLevelNodeTemplate, $hierarchyLevelConfiguration['properties'], $context); + $this->applyProperties($hierarchyLevelNode, $hierarchyLevelConfiguration['properties'], $context); } if ($hierarchyLevelNodeType->isOfType('Neos.Neos:Document') && !isset($hierarchyLevelConfiguration['properties']['uriPathSegment'])) { - $hierarchyLevelNodeTemplate->setProperty('uriPathSegment', $hierarchyLevelNodeTemplate->getName()); + $hierarchyLevelNode->setProperty('uriPathSegment', $hierarchyLevelNode->getName()); } - $hierarchyLevelNode = $parentNode->createNodeFromTemplate($hierarchyLevelNodeTemplate, $hierarchyLevelNodeName); - $this->logger->log(sprintf('Built hierarchy level on path %s with node type %s ', $hierarchyLevelNode->getPath(), $hierarchyLevelConfiguration['type']), LOG_DEBUG); if (isset($hierarchyLevelConfiguration['sorting'])) { @@ -155,12 +156,12 @@ protected function buildHierarchyLevel(NodeInterface $parentNode, array $hierarc } /** - * @param NodeTemplate $node + * @param NodeInterface $node * @param array $properties * @param array $context * @throws \Neos\Eel\Exception */ - protected function applyProperties(NodeTemplate $node, array $properties, array $context) + protected function applyProperties(NodeInterface $node, array $properties, array $context) { foreach ($properties as $propertyName => $propertyValue) { $propertyValue = $this->eelEvaluationService->evaluateIfValidEelExpression($propertyValue, $context);