From a7aaa430f9a095846b06212b28f7d4907fcbebf7 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 17 Oct 2023 00:09:21 +0200 Subject: [PATCH] TASK: Adjust to changes in `NodeType` Adjusts to changes to fix task neos/neos-development-collection#4515 --- .../Changes/AbstractStructuralChange.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Classes/Domain/Model/Changes/AbstractStructuralChange.php b/Classes/Domain/Model/Changes/AbstractStructuralChange.php index de725b5fe4..cf44178df0 100644 --- a/Classes/Domain/Model/Changes/AbstractStructuralChange.php +++ b/Classes/Domain/Model/Changes/AbstractStructuralChange.php @@ -186,15 +186,18 @@ protected function findChildNodes(Node $node): Nodes protected function isNodeTypeAllowedAsChildNode(Node $node, NodeType $nodeType): bool { - $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); - if ($node->classification === NodeAggregateClassification::CLASSIFICATION_TETHERED) { - $parentNode = $subgraph->findParentNode($node->nodeAggregateId); - return !$parentNode || $this->getNodeType($parentNode)->allowsGrandchildNodeType( - $node->nodeName->value, - $nodeType - ); - } else { + if ($node->classification !== NodeAggregateClassification::CLASSIFICATION_TETHERED) { return $this->getNodeType($node)->allowsChildNodeType($nodeType); } + + $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); + $parentNode = $subgraph->findParentNode($node->nodeAggregateId); + $nodeTypeManager = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId)->getNodeTypeManager(); + + return !$parentNode || $nodeTypeManager->isNodeTypeAllowedAsChildToTetheredNode( + $this->getNodeType($parentNode), + $node->nodeName, + $nodeType + ); } }