Skip to content

Commit

Permalink
Merge pull request #4982 from neos/uniqueNamesForRootChildren
Browse files Browse the repository at this point in the history
BUGFIX: Enforce unique names also for root children
  • Loading branch information
nezaniel committed Apr 25, 2024
2 parents 9e4ba1e + 1e48183 commit dab3d0b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,6 @@ public function findTetheredChildNodeAggregates(
return $this->mapQueryBuilderToNodeAggregates($queryBuilder, $contentStreamId);
}

/**
* @param ContentStreamId $contentStreamId
* @param NodeName $nodeName
* @param NodeAggregateId $parentNodeAggregateId
* @param OriginDimensionSpacePoint $parentNodeOriginDimensionSpacePoint
* @param DimensionSpacePointSet $dimensionSpacePointsToCheck
* @return DimensionSpacePointSet
*/
public function getDimensionSpacePointsOccupiedByChildNodeName(
ContentStreamId $contentStreamId,
NodeName $nodeName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ Feature: Create node aggregate with node
| Key | Value |
| nodeAggregateId | "nody-mc-nodeface" |
| nodeTypeName | "Neos.ContentRepository.Testing:Node" |
| originDimensionSpacePoint | {} |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| nodeName | "document" |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,22 @@ Feature: Create node aggregate with node
| parentNodeAggregateId | "sir-david-nodenborough" |
| originDimensionSpacePoint | {"language":"de"} |
Then the last command should have thrown an exception of type "NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint"

Scenario: Try to create a node aggregate with a root parent and a sibling already claiming the name
# root nodes are special in that they have the empty DSP as origin, wich may affect constraint checks
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:Node" |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| originDimensionSpacePoint | {"language":"de"} |
| nodeName | "document" |
And the graph projection is fully up to date
And the command CreateNodeAggregateWithNode is executed with payload and exceptions are caught:
| Key | Value |
| nodeAggregateId | "nody-mc-nodeface" |
| nodeTypeName | "Neos.ContentRepository.Testing:Node" |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| originDimensionSpacePoint | {"language":"de"} |
| nodeName | "document" |
Then the last command should have thrown an exception of type "NodeNameIsAlreadyOccupied"
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ private function handleCreateNodeAggregateWithNodeAndSerializedProperties(
$contentStreamId,
$command->nodeName,
$command->parentNodeAggregateId,
$command->originDimensionSpacePoint,
$parentNodeAggregate->classification->isRoot()
? DimensionSpace\OriginDimensionSpacePoint::createWithoutDimensions()
: $command->originDimensionSpacePoint,
$coveredDimensionSpacePoints,
$contentRepository
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ private function handleCopyNodesRecursively(
$contentStreamId,
$command->targetNodeName,
$command->targetParentNodeAggregateId,
$command->targetDimensionSpacePoint,
$parentNodeAggregate->classification->isRoot()
? OriginDimensionSpacePoint::createWithoutDimensions()
: $command->targetDimensionSpacePoint,
$coveredDimensionSpacePoints,
$contentRepository
);
Expand Down

0 comments on commit dab3d0b

Please sign in to comment.