Skip to content

Commit

Permalink
Merge pull request #3642 from neos/task/90-remove-nodetypemanager-fro…
Browse files Browse the repository at this point in the history
…m-node-4515-squashed

TASK: Adjust to changes in `NodeType`
  • Loading branch information
mhsdesign authored Oct 17, 2023
2 parents 01dfa39 + a7aaa43 commit edf303e
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Classes/Domain/Model/Changes/AbstractStructuralChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}

0 comments on commit edf303e

Please sign in to comment.