diff --git a/Classes/ContentRepository/Service/WorkspaceService.php b/Classes/ContentRepository/Service/WorkspaceService.php index 43cb89155f..d1b9834a3c 100644 --- a/Classes/ContentRepository/Service/WorkspaceService.php +++ b/Classes/ContentRepository/Service/WorkspaceService.php @@ -1,4 +1,5 @@ contentRepositoryRegistry->get($contentRepositoryId); + $contentGraph = $contentRepository->getContentGraph($workspaceName); $pendingChanges = $this->workspacePublishingService->pendingWorkspaceChanges($contentRepositoryId, $workspaceName); /** @var array{contextPath:string,documentContextPath:string,typeOfChange:int}[] $unpublishedNodes */ $unpublishedNodes = []; foreach ($pendingChanges as $change) { - if ($change->removalAttachmentPoint) { + if ($change->removalAttachmentPoint && $change->originDimensionSpacePoint !== null) { $nodeAddress = NodeAddress::create( $contentRepositoryId, $workspaceName, @@ -79,20 +81,31 @@ public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepo 'typeOfChange' => $this->getTypeOfChange($change) ]; } else { - $subgraph = $contentRepository->getContentGraph($workspaceName)->getSubgraph( - $change->originDimensionSpacePoint->toDimensionSpacePoint(), - VisibilityConstraints::withoutRestrictions() - ); - $node = $subgraph->findNodeById($change->nodeAggregateId); - - if ($node instanceof Node) { - $documentNode = $subgraph->findClosestNode($node->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT)); - if ($documentNode instanceof Node) { - $unpublishedNodes[] = [ - 'contextPath' => NodeAddress::fromNode($node)->toJson(), - 'documentContextPath' => NodeAddress::fromNode($documentNode)->toJson(), - 'typeOfChange' => $this->getTypeOfChange($change) - ]; + if ($change->originDimensionSpacePoint !== null) { + $originDimensionSpacePoints = [$change->originDimensionSpacePoint]; + } else { + // If originDimensionSpacePoint is null, we have a change to the nodeAggregate. All nodes in the + // occupied dimensionspacepoints shall be marked as changed. + $originDimensionSpacePoints = $contentGraph + ->findNodeAggregateById($change->nodeAggregateId) + ?->occupiedDimensionSpacePoints ?: []; + } + + foreach ($originDimensionSpacePoints as $originDimensionSpacePoint) { + $subgraph = $contentGraph->getSubgraph( + $originDimensionSpacePoint->toDimensionSpacePoint(), + VisibilityConstraints::withoutRestrictions() + ); + $node = $subgraph->findNodeById($change->nodeAggregateId); + if ($node instanceof Node) { + $documentNode = $subgraph->findClosestNode($node->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT)); + if ($documentNode instanceof Node) { + $unpublishedNodes[] = [ + 'contextPath' => NodeAddress::fromNode($node)->toJson(), + 'documentContextPath' => NodeAddress::fromNode($documentNode)->toJson(), + 'typeOfChange' => $this->getTypeOfChange($change) + ]; + } } } }