Skip to content

Commit 9cebbb9

Browse files
committed
FIX: Remove generalisations dsp with all its fallbacks
Also mark empty dimensions as affected source, but that will be removed wither way with: neos/neos-development-collection#5516 because its wrong.
1 parent 8812286 commit 9cebbb9

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

Classes/Feature/Common/ConstraintChecks.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -698,19 +698,24 @@ protected function getExpectedVersionOfContentStream(
698698
);
699699
}
700700

701-
protected function requireDescendantNodesToNotFallbackToDimensionPointSet(NodeAggregateId $nodeAggregateId, ContentGraphInterface $contentGraph, DimensionSpacePointSet $disallowedDimensionSpacePointFallbackSet): void
701+
protected function requireDescendantNodesToNotFallbackToDimensionPointSet(NodeAggregateId $nodeAggregateId, ContentGraphInterface $contentGraph, DimensionSpacePointSet $dimensionSpacePointsToBeRemoved): void
702702
{
703703
foreach ($contentGraph->findChildNodeAggregates($nodeAggregateId) as $childNodeAggregate) {
704704
foreach ($childNodeAggregate->occupiedDimensionSpacePoints as $occupiedDimensionSpacePoint) {
705-
if (!$disallowedDimensionSpacePointFallbackSet->contains($occupiedDimensionSpacePoint->toDimensionSpacePoint())) {
705+
if (!$dimensionSpacePointsToBeRemoved->contains($occupiedDimensionSpacePoint->toDimensionSpacePoint())) {
706706
continue;
707707
}
708-
$fallbackDimensions = $childNodeAggregate->getCoverageByOccupant($occupiedDimensionSpacePoint)->getDifference(DimensionSpacePointSet::fromArray([$occupiedDimensionSpacePoint->toDimensionSpacePoint()]));
709-
if (!$fallbackDimensions->isEmpty()) {
710-
throw new NodeAggregateDoesCurrentlyNotOccupyDimensionSpacePoint(sprintf('Descendant Node %s in dimensions %s must not fallback to dimension %s which will be removed.', $childNodeAggregate->nodeAggregateId, $fallbackDimensions->toJson(), $occupiedDimensionSpacePoint->toJson()));
708+
$fallbackRemainingDimensions = $childNodeAggregate
709+
->getCoverageByOccupant($occupiedDimensionSpacePoint)
710+
// exclude the occupied e.g. non fallback dimension itself
711+
->getDifference(DimensionSpacePointSet::fromArray([$occupiedDimensionSpacePoint->toDimensionSpacePoint()]))
712+
// exclude all about to removed fallback dimensions
713+
->getDifference($dimensionSpacePointsToBeRemoved);
714+
if (!$fallbackRemainingDimensions->isEmpty()) {
715+
throw new NodeAggregateDoesCurrentlyNotOccupyDimensionSpacePoint(sprintf('Descendant Node %s in dimensions %s must not fallback to dimension %s which will be removed.', $childNodeAggregate->nodeAggregateId, $fallbackRemainingDimensions->toJson(), $occupiedDimensionSpacePoint->toJson()));
711716
}
712717
}
713-
$this->requireDescendantNodesToNotFallbackToDimensionPointSet($childNodeAggregate->nodeAggregateId, $contentGraph, $disallowedDimensionSpacePointFallbackSet);
718+
$this->requireDescendantNodesToNotFallbackToDimensionPointSet($childNodeAggregate->nodeAggregateId, $contentGraph, $dimensionSpacePointsToBeRemoved);
714719
}
715720
}
716721
}

Classes/Feature/RootNodeCreation/RootNodeHandling.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,14 @@ private function handleUpdateRootNodeAggregateDimensions(
177177
$events = [];
178178
if (!$removedDimensionSpacePoints->isEmpty()) {
179179
$this->requireDescendantNodesToNotFallbackToDimensionPointSet($rootNodeAggregate->nodeAggregateId, $contentGraph, $removedDimensionSpacePoints);
180-
foreach ($removedDimensionSpacePoints as $removedDimensionSpacePoint) {
181-
$events[] = new NodeAggregateWasRemoved(
182-
$contentGraph->getWorkspaceName(),
183-
$contentGraph->getContentStreamId(),
184-
$rootNodeAggregate->nodeAggregateId,
185-
new OriginDimensionSpacePointSet([OriginDimensionSpacePoint::fromDimensionSpacePoint($removedDimensionSpacePoint)]),
186-
new DimensionSpacePointSet([$removedDimensionSpacePoint]),
187-
);
188-
}
180+
$events[] = new NodeAggregateWasRemoved(
181+
$contentGraph->getWorkspaceName(),
182+
$contentGraph->getContentStreamId(),
183+
$rootNodeAggregate->nodeAggregateId,
184+
// TODO root nodes never occupy, but this field is odd, unused and to be removed either way: https://github.com/neos/neos-development-collection/pull/5516
185+
affectedOccupiedDimensionSpacePoints: OriginDimensionSpacePointSet::fromArray([]),
186+
affectedCoveredDimensionSpacePoints: $removedDimensionSpacePoints,
187+
);
189188
}
190189

191190
if (!$newDimensionSpacePoints->isEmpty()) {

0 commit comments

Comments
 (0)