diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php index d0ea7f49e90..ce969843ef1 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php @@ -25,7 +25,7 @@ final class SetNodeReferences implements CommandInterface * @param ReferenceName $referenceName Name of the reference to set * @param NodeReferencesToWrite $references Unserialized reference(s) to set */ - public function __construct( + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $sourceNodeAggregateId, public readonly OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php index 060135a4f4e..6c3836dc81c 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php @@ -33,31 +33,27 @@ final class RemoveNodeAggregate implements MatchableWithNodeIdToPublishOrDiscardInterface { /** - * @param ContentStreamId $contentStreamId + * @param ContentStreamId $contentStreamId The content stream in which the remove operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to remove + * @param DimensionSpacePoint $coveredDimensionSpacePoint One of the dimension space points covered by the node aggregate in which the user intends to remove it + * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be removed + * @param NodeAggregateId|null $removalAttachmentPoint Internal. It stores the document node id of the removed node, as that is what the UI needs later on for the change display. {@see self::withRemovalAttachmentPoint()} */ - public function __construct( + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, - /** One of the dimension space points covered by the node aggregate in which the user intends to remove it */ public readonly DimensionSpacePoint $coveredDimensionSpacePoint, public readonly NodeVariantSelectionStrategy $nodeVariantSelectionStrategy, - /** - * This is usually the NodeAggregateId of the parent node of the deleted node. It is needed for instance - * in the Neos UI for the following scenario: - * - when removing a node, you still need to be able to publish the removal. - * - For this to work, the Neos UI needs to know the id of the removed Node, **on the page - * where the removal happened** (so that the user can decide to publish a single page INCLUDING the removal - * on the page) - * - Because this command will *remove* the edge, - * we cannot know the position in the tree after doing the removal anymore. - * - * That's why we need this field: For the Neos UI, it stores the document node of the removed node - * (see Remove.php), as that is what the UI needs lateron for the change display. - */ public readonly ?NodeAggregateId $removalAttachmentPoint ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the remove operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to remove + * @param DimensionSpacePoint $coveredDimensionSpacePoint One of the dimension space points covered by the node aggregate in which the user intends to remove it + * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be removed + */ public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self { return new self($contentStreamId, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy, null); @@ -80,6 +76,14 @@ public static function fromArray(array $array): self } /** + * This adds usually the NodeAggregateId of the parent document node of the deleted node. + * It is needed for instance in the Neos UI for the following scenario: + * - when removing a node, you still need to be able to publish the removal. + * - For this to work, the Neos UI needs to know the id of the removed Node, **on the page where the removal happened** + * (so that the user can decide to publish a single page INCLUDING the removal on the page) + * - Because this command will *remove* the edge, + * we cannot know the position in the tree after doing the removal anymore. + * * @param NodeAggregateId $removalAttachmentPoint * @internal */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php index 873d00e5925..5f4100b6e2f 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php @@ -29,29 +29,13 @@ final class PublishIndividualNodesFromWorkspace implements CommandInterface /** * @param WorkspaceName $workspaceName Name of the affected workspace * @param NodeIdsToPublishOrDiscard $nodesToPublish Ids of the nodes to publish or discard - * @param ContentStreamId $contentStreamIdForMatchingPart The id of the new content stream that will contain all events to be published - * @param ContentStreamId $contentStreamIdForRemainingPart The id of the new content stream that will contain all remaining events + * @param ContentStreamId $contentStreamIdForMatchingPart The id of the new content stream that will contain all events to be published {@see self::withContentStreamIdForMatchingPart()} + * @param ContentStreamId $contentStreamIdForRemainingPart The id of the new content stream that will contain all remaining events {@see self::withContentStreamIdForRemainingPart()} */ private function __construct( public readonly WorkspaceName $workspaceName, public readonly NodeIdsToPublishOrDiscard $nodesToPublish, - /** - * during the publish process, we sort the events so that the events we want to publish - * come first. In this process, two new content streams are generated: - * - the first one contains all events which we want to publish - * - the second one is based on the first one, and contains all the remaining events (which we want to keep - * in the user workspace). - * - * This property contains the ID of the first content stream, so that this command - * can run fully deterministic - we need this for the test cases. - */ public readonly ContentStreamId $contentStreamIdForMatchingPart, - /** - * See the description of {@see $contentStreamIdForMatchingPart}. - * - * This property contains the ID of the second content stream, so that this command - * can run fully deterministic - we need this for the test cases. - */ public readonly ContentStreamId $contentStreamIdForRemainingPart ) { } @@ -70,11 +54,27 @@ public static function create(WorkspaceName $workspaceName, NodeIdsToPublishOrDi ); } + /** + * During the publish process, we sort the events so that the events we want to publish + * come first. In this process, two new content streams are generated: + * - the first one contains all events which we want to publish + * - the second one is based on the first one, and contains all the remaining events (which we want to keep + * in the user workspace). + * + * This method adds the ID of the first content stream, so that the command + * can run fully deterministic - we need this for the test cases. + */ public function withContentStreamIdForMatchingPart(ContentStreamId $contentStreamIdForMatchingPart): self { return new self($this->workspaceName, $this->nodesToPublish, $contentStreamIdForMatchingPart, $this->contentStreamIdForRemainingPart); } + /** + * See the description of {@see self::withContentStreamIdForMatchingPart()}. + * + * This property adds the ID of the second content stream, so that the command + * can run fully deterministic - we need this for the test cases. + */ public function withContentStreamIdForRemainingPart(ContentStreamId $contentStreamIdForRemainingPart): self { return new self($this->workspaceName, $this->nodesToPublish, $this->contentStreamIdForMatchingPart, $contentStreamIdForRemainingPart); diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeReferencing.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeReferencing.php index 3f9deb68f63..d43d4b26628 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeReferencing.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeReferencing.php @@ -66,7 +66,7 @@ public function theCommandSetNodeReferencesIsExecutedWithPayload(TableNode $payl ) ); - $command = new SetNodeReferences( + $command = SetNodeReferences::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['sourceNodeAggregateId']), $sourceOriginDimensionSpacePoint,