From 98a7cb195bfb74616730ebbf36d2e5bf5998ef2a Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:40:38 +0100 Subject: [PATCH] WIP: Use node aggregate ids WITH dsp for `WorkspaceWasPartiallyPublished` in preparation of partial dimension publish ... at some point --- .../Classes/Feature/RebaseableCommands.php | 1 + .../Feature/WorkspaceCommandHandler.php | 7 ++++++- .../Event/WorkspaceWasPartiallyPublished.php | 18 ++++++------------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php b/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php index 3c63542f56..3a29dacd7d 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php +++ b/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php @@ -76,6 +76,7 @@ private static function commandMatchesAtLeastOneNode( NodeAggregateIds $nodeIdsToMatch, ): bool { foreach ($nodeIdsToMatch as $nodeId) { + // todo rather use the domain event here and use `EmbedsNodeAggregateId` already! /** * This match must contain all commands which are working with individual nodes, such that they are * filterable whether they are applying their action to a NodeIdToPublish. diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 1e3e586cbe..a8a49b7454 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -477,6 +477,11 @@ private function handlePublishIndividualNodesFromWorkspace( return; } + // todo we should - similar to discard - also add the node aggregate IDs with dimension point to the event again. The question is if we use the old events to analyse that or the newly emitted (today) events? + // could they come to a different result like MORE or less dimensions are suddenly affected because of a change in configuration? And would it make sense to use the old or new events then? Probably the old + // to make it consistent with discard. + $nodesToPublish = $this->extractNodeAggregateIdsAndAffectedDimensionSpacePoints($matchingCommands); + yield $this->closeContentStream( $workspace->currentContentStreamId, $workspaceContentStreamVersion @@ -550,7 +555,7 @@ static function ($handle) use ($commandSimulator, $matchingCommands, $remainingC $baseWorkspace->workspaceName, $command->contentStreamIdForRemainingPart, $workspace->currentContentStreamId, - $command->nodesToPublish + $nodesToPublish ) ]), ExpectedVersion::ANY() diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Event/WorkspaceWasPartiallyPublished.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Event/WorkspaceWasPartiallyPublished.php index 38ae4f42b6..4659d6c2a4 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Event/WorkspaceWasPartiallyPublished.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Event/WorkspaceWasPartiallyPublished.php @@ -15,7 +15,7 @@ namespace Neos\ContentRepository\Core\Feature\WorkspacePublication\Event; use Neos\ContentRepository\Core\EventStore\EventInterface; -use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds; +use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdsToPublishOrDiscard; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; @@ -41,27 +41,21 @@ public function __construct( * The old content stream, which contains ALL the data (discarded and non-discarded) */ public ContentStreamId $previousSourceContentStreamId, - public NodeAggregateIds $publishedNodes, + /** + * Todo docs! + */ + public NodeIdsToPublishOrDiscard $publishedNodes, ) { } public static function fromArray(array $values): self { - $publishedNodes = []; - foreach ($values['publishedNodes'] as $publishedNode) { - if (is_array($publishedNode)) { - // legacy case: - $publishedNodes[] = $publishedNode['nodeAggregateId']; - continue; - } - $publishedNodes[] = $publishedNode; - } return new self( WorkspaceName::fromString($values['sourceWorkspaceName']), WorkspaceName::fromString($values['targetWorkspaceName']), ContentStreamId::fromString($values['newSourceContentStreamId']), ContentStreamId::fromString($values['previousSourceContentStreamId']), - NodeAggregateIds::fromArray($publishedNodes), + NodeIdsToPublishOrDiscard::fromArray($values['publishedNodes']), ); }