diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php index 101d59ed37c..be851203b64 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php @@ -239,7 +239,7 @@ private function whenRootNodeAggregateWithNodeWasCreated(RootNodeAggregateWithNo $event->nodeAggregateId, $originDimensionSpacePoint->coordinates, $originDimensionSpacePoint->hash, - SerializedPropertyValues::fromArray([]), + SerializedPropertyValues::createEmpty(), $event->nodeTypeName, $event->nodeAggregateClassification, null, diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeCreation.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeCreation.php index ea0f7aa720e..56bd658091f 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeCreation.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeCreation.php @@ -51,7 +51,7 @@ private function whenRootNodeAggregateWithNodeWasCreated(RootNodeAggregateWithNo $event->nodeAggregateId, $originDimensionSpacePoint, $originDimensionSpacePoint->hash, - SerializedPropertyValues::fromArray([]), + SerializedPropertyValues::createEmpty(), $event->nodeTypeName, $event->nodeAggregateClassification, null diff --git a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php index cc249e76400..7ae6c50e56d 100644 --- a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php +++ b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php @@ -76,7 +76,7 @@ public function removeEverything(): void public function createNodesForPerformanceTest(int $nodesPerLevel, int $levels): void { - $this->contentRepository->handle(new CreateRootWorkspace( + $this->contentRepository->handle(CreateRootWorkspace::create( WorkspaceName::forLive(), WorkspaceTitle::fromString('live'), WorkspaceDescription::fromString(''), @@ -135,7 +135,7 @@ private function createHierarchy( $this->dimensionSpacePoints, $parentNodeAggregateId, null, - SerializedPropertyValues::fromArray([]), + SerializedPropertyValues::createEmpty(), NodeAggregateClassification::CLASSIFICATION_REGULAR, ); $sumSoFar++; @@ -153,7 +153,7 @@ private function createHierarchy( public function forkContentStream(): void { - $this->contentRepository->handle(new ForkContentStream( + $this->contentRepository->handle(ForkContentStream::create( ContentStreamId::create(), $this->contentStreamId, )); diff --git a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCreation/Command/CreateContentStream.php b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCreation/Command/CreateContentStream.php index 929ed6b555d..aeeee0aba79 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCreation/Command/CreateContentStream.php +++ b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCreation/Command/CreateContentStream.php @@ -25,8 +25,19 @@ */ final class CreateContentStream implements CommandInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The id of the content stream to create + */ + private function __construct( public readonly ContentStreamId $contentStreamId, ) { } + + /** + * @param ContentStreamId $contentStreamId The id of the content stream to create + */ + public static function create(ContentStreamId $contentStreamId): self + { + return new self($contentStreamId); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamForking/Command/ForkContentStream.php b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamForking/Command/ForkContentStream.php index b96ef0b6af4..d8d104a26ff 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamForking/Command/ForkContentStream.php +++ b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamForking/Command/ForkContentStream.php @@ -16,7 +16,6 @@ use Neos\ContentRepository\Core\CommandHandler\CommandInterface; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; -use Neos\ContentRepository\Core\SharedModel\User\UserId; /** * ForkContentStream for creating a new fork of a content stream. @@ -25,17 +24,25 @@ */ final class ForkContentStream implements CommandInterface { - public function __construct( - /** - * Content stream id for the new content stream - * - * @var ContentStreamId - */ + /** + * @param ContentStreamId $newContentStreamId The id of the new content stream + * @param ContentStreamId $sourceContentStreamId The id of the content stream to fork + */ + private function __construct( public readonly ContentStreamId $newContentStreamId, public readonly ContentStreamId $sourceContentStreamId, ) { } + /** + * @param ContentStreamId $newContentStreamId The id of the new content stream + * @param ContentStreamId $sourceContentStreamId The id of the content stream to fork + */ + public static function create(ContentStreamId $newContentStreamId, ContentStreamId $sourceContentStreamId): self + { + return new self($newContentStreamId, $sourceContentStreamId); + } + /** * @param array $array * @internal only used for testcases diff --git a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamRemoval/Command/RemoveContentStream.php b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamRemoval/Command/RemoveContentStream.php index 832ebac0ba0..42f8c179600 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamRemoval/Command/RemoveContentStream.php +++ b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamRemoval/Command/RemoveContentStream.php @@ -24,8 +24,19 @@ */ final class RemoveContentStream implements CommandInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The id of the content stream to remove + */ + private function __construct( public readonly ContentStreamId $contentStreamId, ) { } + + /** + * @param ContentStreamId $contentStreamId The id of the content stream to remove + */ + public static function create(ContentStreamId $contentStreamId): self + { + return new self($contentStreamId); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php index f1ff20f5efe..78097c5cdbe 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php +++ b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php @@ -37,13 +37,28 @@ final class AddDimensionShineThrough implements \JsonSerializable, RebasableToOtherContentStreamsInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The id of the content stream to perform the operation in + * @param DimensionSpacePoint $source source dimension space point + * @param DimensionSpacePoint $target target dimension space point + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly DimensionSpacePoint $source, public readonly DimensionSpacePoint $target ) { } + /** + * @param ContentStreamId $contentStreamId The id of the content stream to perform the operation in + * @param DimensionSpacePoint $source source dimension space point + * @param DimensionSpacePoint $target target dimension space point + */ + public static function create(ContentStreamId $contentStreamId, DimensionSpacePoint $source, DimensionSpacePoint $target): self + { + return new self($contentStreamId, $source, $target); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php index 9165e804e47..1cad2b90c64 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php +++ b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php @@ -33,13 +33,28 @@ final class MoveDimensionSpacePoint implements CommandInterface, RebasableToOtherContentStreamsInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The id of the content stream to perform the operation in + * @param DimensionSpacePoint $source source dimension space point + * @param DimensionSpacePoint $target target dimension space point + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly DimensionSpacePoint $source, public readonly DimensionSpacePoint $target ) { } + /** + * @param ContentStreamId $contentStreamId The id of the content stream to perform the operation in + * @param DimensionSpacePoint $source source dimension space point + * @param DimensionSpacePoint $target target dimension space point + */ + public static function create(ContentStreamId $contentStreamId, DimensionSpacePoint $source, DimensionSpacePoint $target): self + { + return new self($contentStreamId, $source, $target); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNode.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNode.php index 081b877b0d8..545efc0d80d 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNode.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNode.php @@ -36,53 +36,42 @@ final class CreateNodeAggregateWithNode implements CommandInterface { /** - * Node aggregate id of the node's succeeding sibling (optional) - * If not given, the node will be added as the parent's first child + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $nodeAggregateId The unique identifier of the node aggregate to create + * @param NodeTypeName $nodeTypeName Name of the node type of the new node + * @param OriginDimensionSpacePoint $originDimensionSpacePoint Origin of the new node in the dimension space. Will also be used to calculate a set of dimension points where the new node will cover from the configured specializations. + * @param NodeAggregateId $parentNodeAggregateId The id of the node aggregate underneath which the new node is added + * @param PropertyValuesToWrite $initialPropertyValues The node's initial property values. Will be merged over the node type's default property values + * @param NodeAggregateId|null $succeedingSiblingNodeAggregateId Node aggregate id of the node's succeeding sibling (optional). If not given, the node will be added as the parent's first child + * @param NodeName|null $nodeName The node's optional name. Set if there is a meaningful relation to its parent that should be named. + * @param NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds Predefined aggregate ids of tethered child nodes per path. For any tethered node that has no matching entry in this set, the node aggregate id is generated randomly. Since tethered nodes may have tethered child nodes themselves, this works for multiple levels ({@see self::withTetheredDescendantNodeAggregateIds()}) */ - public readonly ?NodeAggregateId $succeedingSiblingNodeAggregateId; - - /** - * The node's optional name. Set if there is a meaningful relation to its parent that should be named. - */ - public readonly ?NodeName $nodeName; - - /** - * The node's initial property values. Will be merged over the node type's default property values - */ - public readonly PropertyValuesToWrite $initialPropertyValues; - - /** - * NodeAggregateIds for tethered descendants (optional). - * - * If the given node type declares tethered child nodes, you may predefine their node aggregate ids - * using this assignment registry. - * Since tethered child nodes may have tethered child nodes themselves, - * this registry is indexed using relative node paths to the node to create in the first place. - */ - public readonly NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds; - - // TODO: CREATE METHODS FÜR ALLE COMMANDS - public function __construct( + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly NodeTypeName $nodeTypeName, - /** - * Origin of the new node in the dimension space. - * Will also be used to calculate a set of dimension points where the new node will cover - * from the configured specializations. - */ public readonly OriginDimensionSpacePoint $originDimensionSpacePoint, public readonly NodeAggregateId $parentNodeAggregateId, - ?NodeAggregateId $succeedingSiblingNodeAggregateId = null, - ?NodeName $nodeName = null, - ?PropertyValuesToWrite $initialPropertyValues = null, - ?NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds = null + public readonly PropertyValuesToWrite $initialPropertyValues, + public readonly ?NodeAggregateId $succeedingSiblingNodeAggregateId, + public readonly ?NodeName $nodeName, + public readonly NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds, ) { - $this->succeedingSiblingNodeAggregateId = $succeedingSiblingNodeAggregateId; - $this->nodeName = $nodeName; - $this->initialPropertyValues = $initialPropertyValues ?: PropertyValuesToWrite::fromArray([]); - $this->tetheredDescendantNodeAggregateIds = $tetheredDescendantNodeAggregateIds - ?: new NodeAggregateIdsByNodePaths([]); + } + + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $nodeAggregateId The unique identifier of the node aggregate to create + * @param NodeTypeName $nodeTypeName Name of the node type of the new node + * @param OriginDimensionSpacePoint $originDimensionSpacePoint Origin of the new node in the dimension space. Will also be used to calculate a set of dimension points where the new node will cover from the configured specializations. + * @param NodeAggregateId $parentNodeAggregateId The id of the node aggregate underneath which the new node is added + * @param NodeAggregateId|null $succeedingSiblingNodeAggregateId Node aggregate id of the node's succeeding sibling (optional). If not given, the node will be added as the parent's first child + * @param NodeName|null $nodeName The node's optional name. Set if there is a meaningful relation to its parent that should be named. + * @param PropertyValuesToWrite|null $initialPropertyValues The node's initial property values. Will be merged over the node type's default property values + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateId $parentNodeAggregateId, ?NodeAggregateId $succeedingSiblingNodeAggregateId = null, ?NodeName $nodeName = null, ?PropertyValuesToWrite $initialPropertyValues = null): self + { + return new self($contentStreamId, $nodeAggregateId, $nodeTypeName, $originDimensionSpacePoint, $parentNodeAggregateId, $initialPropertyValues ?: PropertyValuesToWrite::createEmpty(), $succeedingSiblingNodeAggregateId, $nodeName, NodeAggregateIdsByNodePaths::createEmpty()); } public function withInitialPropertyValues(PropertyValuesToWrite $newInitialPropertyValues): self @@ -93,10 +82,25 @@ public function withInitialPropertyValues(PropertyValuesToWrite $newInitialPrope $this->nodeTypeName, $this->originDimensionSpacePoint, $this->parentNodeAggregateId, + $newInitialPropertyValues, $this->succeedingSiblingNodeAggregateId, $this->nodeName, - $newInitialPropertyValues, - $this->tetheredDescendantNodeAggregateIds + $this->tetheredDescendantNodeAggregateIds, + ); + } + + public function withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds): self + { + return new self( + $this->contentStreamId, + $this->nodeAggregateId, + $this->nodeTypeName, + $this->originDimensionSpacePoint, + $this->parentNodeAggregateId, + $this->initialPropertyValues, + $this->succeedingSiblingNodeAggregateId, + $this->nodeName, + $tetheredDescendantNodeAggregateIds, ); } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php index cf88f165d2a..bd9edf3a9e1 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php @@ -39,52 +39,42 @@ final class CreateNodeAggregateWithNodeAndSerializedProperties implements MatchableWithNodeIdToPublishOrDiscardInterface { /** - * The node's optional name. Set if there is a meaningful relation to its parent that should be named. + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $nodeAggregateId The unique identifier of the node aggregate to create + * @param NodeTypeName $nodeTypeName Name of the node type of the new node + * @param OriginDimensionSpacePoint $originDimensionSpacePoint Origin of the new node in the dimension space. Will also be used to calculate a set of dimension points where the new node will cover from the configured specializations. + * @param NodeAggregateId $parentNodeAggregateId The id of the node aggregate underneath which the new node is added + * @param SerializedPropertyValues $initialPropertyValues The node's initial property values (serialized). Will be merged over the node type's default property values + * @param NodeAggregateId|null $succeedingSiblingNodeAggregateId Node aggregate id of the node's succeeding sibling (optional). If not given, the node will be added as the parent's first child + * @param NodeName|null $nodeName The node's optional name. Set if there is a meaningful relation to its parent that should be named. + * @param NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds Predefined aggregate ids of tethered child nodes per path. For any tethered node that has no matching entry in this set, the node aggregate id is generated randomly. Since tethered nodes may have tethered child nodes themselves, this works for multiple levels ({@see self::withTetheredDescendantNodeAggregateIds()}) */ - public readonly ?NodeName $nodeName; - - /** - * Node aggregate identifier of the node's succeeding sibling (optional) - * If not given, the node will be added as the parent's first child - */ - public readonly ?NodeAggregateId $succeedingSiblingNodeAggregateId; - - /** - * The node's initial property values. Will be merged over the node type's default property values - */ - public readonly SerializedPropertyValues $initialPropertyValues; - - /** - * NodeAggregateIds for tethered descendants (optional). - * - * If the given node type declares tethered child nodes, you may predefine their node aggregate ids - * using this assignment registry. - * Since tethered child nodes may have tethered child nodes themselves, - * this registry is indexed using relative node paths to the node to create in the first place. - */ - public readonly NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds; - - public function __construct( + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly NodeTypeName $nodeTypeName, - /** - * Origin of the new node in the dimension space. - * Will also be used to calculate a set of dimension points where the new node will cover - * from the configured specializations. - */ public readonly OriginDimensionSpacePoint $originDimensionSpacePoint, public readonly NodeAggregateId $parentNodeAggregateId, - ?NodeAggregateId $succeedingSiblingNodeAggregateId = null, - ?NodeName $nodeName = null, - ?SerializedPropertyValues $initialPropertyValues = null, - ?NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds = null + public readonly SerializedPropertyValues $initialPropertyValues, + public readonly ?NodeAggregateId $succeedingSiblingNodeAggregateId, + public readonly ?NodeName $nodeName, + public readonly NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds ) { - $this->succeedingSiblingNodeAggregateId = $succeedingSiblingNodeAggregateId; - $this->nodeName = $nodeName; - $this->initialPropertyValues = $initialPropertyValues ?: SerializedPropertyValues::fromArray([]); - $this->tetheredDescendantNodeAggregateIds = $tetheredDescendantNodeAggregateIds - ?: new NodeAggregateIdsByNodePaths([]); + } + + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $nodeAggregateId The unique identifier of the node aggregate to create + * @param NodeTypeName $nodeTypeName Name of the node type of the new node + * @param OriginDimensionSpacePoint $originDimensionSpacePoint Origin of the new node in the dimension space. Will also be used to calculate a set of dimension points where the new node will cover from the configured specializations. + * @param NodeAggregateId $parentNodeAggregateId The id of the node aggregate underneath which the new node is added + * @param NodeAggregateId|null $succeedingSiblingNodeAggregateId Node aggregate id of the node's succeeding sibling (optional). If not given, the node will be added as the parent's first child + * @param NodeName|null $nodeName The node's optional name. Set if there is a meaningful relation to its parent that should be named. + * @param SerializedPropertyValues|null $initialPropertyValues The node's initial property values (serialized). Will be merged over the node type's default property values + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateId $parentNodeAggregateId, NodeAggregateId $succeedingSiblingNodeAggregateId = null, NodeName $nodeName = null, SerializedPropertyValues $initialPropertyValues = null): self + { + return new self($contentStreamId, $nodeAggregateId, $nodeTypeName, $originDimensionSpacePoint, $parentNodeAggregateId, $initialPropertyValues ?? SerializedPropertyValues::createEmpty(), $succeedingSiblingNodeAggregateId, $nodeName, NodeAggregateIdsByNodePaths::createEmpty()); } /** @@ -98,18 +88,18 @@ public static function fromArray(array $array): self NodeTypeName::fromString($array['nodeTypeName']), OriginDimensionSpacePoint::fromArray($array['originDimensionSpacePoint']), NodeAggregateId::fromString($array['parentNodeAggregateId']), + isset($array['initialPropertyValues']) + ? SerializedPropertyValues::fromArray($array['initialPropertyValues']) + : SerializedPropertyValues::createEmpty(), isset($array['succeedingSiblingNodeAggregateId']) ? NodeAggregateId::fromString($array['succeedingSiblingNodeAggregateId']) : null, isset($array['nodeName']) ? NodeName::fromString($array['nodeName']) : null, - isset($array['initialPropertyValues']) - ? SerializedPropertyValues::fromArray($array['initialPropertyValues']) - : null, isset($array['tetheredDescendantNodeAggregateIds']) ? NodeAggregateIdsByNodePaths::fromArray($array['tetheredDescendantNodeAggregateIds']) - : null + : NodeAggregateIdsByNodePaths::createEmpty() ); } @@ -129,9 +119,9 @@ public function withTetheredDescendantNodeAggregateIds( $this->nodeTypeName, $this->originDimensionSpacePoint, $this->parentNodeAggregateId, + $this->initialPropertyValues, $this->succeedingSiblingNodeAggregateId, $this->nodeName, - $this->initialPropertyValues, $tetheredDescendantNodeAggregateIds ); } @@ -152,9 +142,9 @@ public function createCopyForContentStream(ContentStreamId $target): self $this->nodeTypeName, $this->originDimensionSpacePoint, $this->parentNodeAggregateId, + $this->initialPropertyValues, $this->succeedingSiblingNodeAggregateId, $this->nodeName, - $this->initialPropertyValues, $this->tetheredDescendantNodeAggregateIds ); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php index f35eb3a1723..1eba8ab7399 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php @@ -119,6 +119,11 @@ public function getNodeAggregateIds(): array return $this->nodeAggregateIds; } + public function isEmpty(): bool + { + return $this->nodeAggregateIds === []; + } + /** * @return array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php index 10cc11bc488..46ef4e6a46b 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php @@ -72,7 +72,7 @@ private function handleCreateNodeAggregateWithNode( ); $this->validateProperties($command->initialPropertyValues, $command->nodeTypeName); - $lowLevelCommand = new CreateNodeAggregateWithNodeAndSerializedProperties( + $lowLevelCommand = CreateNodeAggregateWithNodeAndSerializedProperties::create( $command->contentStreamId, $command->nodeAggregateId, $command->nodeTypeName, @@ -83,9 +83,11 @@ private function handleCreateNodeAggregateWithNode( $this->getPropertyConverter()->serializePropertyValues( $command->initialPropertyValues, $this->requireNodeType($command->nodeTypeName) - ), - $command->tetheredDescendantNodeAggregateIds + ) ); + if (!$command->tetheredDescendantNodeAggregateIds->isEmpty()) { + $lowLevelCommand = $lowLevelCommand->withTetheredDescendantNodeAggregateIds($command->tetheredDescendantNodeAggregateIds); + } return $this->handleCreateNodeAggregateWithNodeAndSerializedProperties($lowLevelCommand, $contentRepository); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php index 1aa895f1aab..1d65963c489 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php @@ -34,16 +34,31 @@ final class DisableNodeAggregate implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the disable operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to disable + * @param DimensionSpacePoint $coveredDimensionSpacePoint The covered dimension space point of the node aggregate in which the user intends to disable it + * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be disabled + */ + 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 disable it */ public readonly DimensionSpacePoint $coveredDimensionSpacePoint, - /** The strategy the user chose to determine which specialization variants will also be disabled */ public readonly NodeVariantSelectionStrategy $nodeVariantSelectionStrategy, ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the disable operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to disable + * @param DimensionSpacePoint $coveredDimensionSpacePoint The covered dimension space point of the node aggregate in which the user intends to disable it + * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be disabled + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self + { + return new self($contentStreamId, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php index ca7a11e71f9..5bce9711699 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php @@ -34,16 +34,31 @@ final class EnableNodeAggregate implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the enable operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to enable + * @param DimensionSpacePoint $coveredDimensionSpacePoint The covered dimension space point of the node aggregate in which the user intends to enable it + * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be enabled + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, - /** The covered dimension space point of the node aggregate in which the user intends to enable it */ public readonly DimensionSpacePoint $coveredDimensionSpacePoint, - /** The strategy the user chose to determine which specialization variants will also be disabled */ public readonly NodeVariantSelectionStrategy $nodeVariantSelectionStrategy, ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the enable operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to enable + * @param DimensionSpacePoint $coveredDimensionSpacePoint The covered dimension space point of the node aggregate in which the user intends to enable it + * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be enabled + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self + { + return new self($contentStreamId, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php index 2102ca61d22..6fbefbce937 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php @@ -42,51 +42,40 @@ final class CopyNodesRecursively implements MatchableWithNodeIdToPublishOrDiscardInterface, RebasableToOtherContentStreamsInterface { + /** + * @param ContentStreamId $contentStreamId The id of the content stream this command is to be handled in + * @param NodeSubtreeSnapshot $nodeTreeToInsert The snapshot of nodes to copy {@see CopyNodesRecursively::createFromSubgraphAndStartNode()} + * @param OriginDimensionSpacePoint $targetDimensionSpacePoint the dimension space point which is the target of the copy + * @param NodeAggregateId $targetParentNodeAggregateId Node aggregate id of the target node's parent. If not given, the node will be added as the parent's first child + * @param NodeAggregateId|null $targetSucceedingSiblingNodeAggregateId Node aggregate id of the target node's succeeding sibling (optional) + * @param NodeName|null $targetNodeName the root node name of the root-inserted-node + * @param NodeAggregateIdMapping $nodeAggregateIdMapping An assignment of "old" to "new" NodeAggregateIds ({@see NodeAggregateIdMapping}) + */ private function __construct( - /** - * The id of the content stream this command is to be handled in - * - * @var ContentStreamId - */ public readonly ContentStreamId $contentStreamId, - /** - * The to be copied node's node aggregate id - * - * @var NodeSubtreeSnapshot - */ public readonly NodeSubtreeSnapshot $nodeTreeToInsert, - /** - * the dimension space point which is the target of the copy - * - * @var OriginDimensionSpacePoint - */ public readonly OriginDimensionSpacePoint $targetDimensionSpacePoint, - /** - * Node aggregate id of the target node's parent (optional) - * - * If not given, the node will be added as a root node - * - * @var NodeAggregateId - */ public readonly NodeAggregateId $targetParentNodeAggregateId, - /** - * Node aggregate id of the target node's succeeding sibling (optional) - * - * If not given, the node will be added as the parent's first child - * - * @var NodeAggregateId|null - */ public readonly ?NodeAggregateId $targetSucceedingSiblingNodeAggregateId, - /** - * the root node name of the root-inserted-node - * - * @var NodeName|null - */ public readonly ?NodeName $targetNodeName, public readonly NodeAggregateIdMapping $nodeAggregateIdMapping ) { } + /** + * @param ContentStreamId $contentStreamId The id of the content stream this command is to be handled in + * @param NodeSubtreeSnapshot $nodeTreeToInsert The snapshot of nodes to copy {@see CopyNodesRecursively::createFromSubgraphAndStartNode()} + * @param OriginDimensionSpacePoint $targetDimensionSpacePoint the dimension space point which is the target of the copy + * @param NodeAggregateId $targetParentNodeAggregateId Node aggregate id of the target node's parent. If not given, the node will be added as the parent's first child + * @param NodeAggregateId|null $targetSucceedingSiblingNodeAggregateId Node aggregate id of the target node's succeeding sibling (optional) + * @param NodeName|null $targetNodeName the root node name of the root-inserted-node + * @param NodeAggregateIdMapping $nodeAggregateIdMapping An assignment of "old" to "new" NodeAggregateIds ({@see NodeAggregateIdMapping}) + */ + public static function create(ContentStreamId $contentStreamId, NodeSubtreeSnapshot $nodeTreeToInsert, OriginDimensionSpacePoint $targetDimensionSpacePoint, NodeAggregateId $targetParentNodeAggregateId, ?NodeAggregateId $targetSucceedingSiblingNodeAggregateId, ?NodeName $targetNodeName, NodeAggregateIdMapping $nodeAggregateIdMapping): self + { + return new self($contentStreamId, $nodeTreeToInsert, $targetDimensionSpacePoint, $targetParentNodeAggregateId, $targetSucceedingSiblingNodeAggregateId, $targetNodeName, $nodeAggregateIdMapping); + } + /** * @todo (could be an extra method) reference start node by address instead of passing it */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetNodeProperties.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetNodeProperties.php index 16a7dfaa8db..6950e7d06a9 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetNodeProperties.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetNodeProperties.php @@ -33,11 +33,28 @@ */ final class SetNodeProperties implements CommandInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the set properties operation is to be performed + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to set the properties for + * @param OriginDimensionSpacePoint $originDimensionSpacePoint The dimension space point the properties should be changed in + * @param PropertyValuesToWrite $propertyValues Names and (unserialized) values of properties to set + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly OriginDimensionSpacePoint $originDimensionSpacePoint, public readonly PropertyValuesToWrite $propertyValues, ) { } + + /** + * @param ContentStreamId $contentStreamId The content stream in which the set properties operation is to be performed + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to set the properties for + * @param OriginDimensionSpacePoint $originDimensionSpacePoint The dimension space point the properties should be changed in + * @param PropertyValuesToWrite $propertyValues Names and (unserialized) values of properties to set + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, OriginDimensionSpacePoint $originDimensionSpacePoint, PropertyValuesToWrite $propertyValues): self + { + return new self($contentStreamId, $nodeAggregateId, $originDimensionSpacePoint, $propertyValues); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php index 7f541669409..03cd7bcfe8d 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php @@ -36,7 +36,13 @@ final class SetSerializedNodeProperties implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the set properties operation is to be performed + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to set the properties for + * @param OriginDimensionSpacePoint $originDimensionSpacePoint The dimension space point the properties should be changed in + * @param SerializedPropertyValues $propertyValues Names and (serialized) values of properties to set + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly OriginDimensionSpacePoint $originDimensionSpacePoint, @@ -44,6 +50,17 @@ public function __construct( ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the set properties operation is to be performed + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to set the properties for + * @param OriginDimensionSpacePoint $originDimensionSpacePoint The dimension space point the properties should be changed in + * @param SerializedPropertyValues $propertyValues Names and (serialized) values of properties to set + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, OriginDimensionSpacePoint $originDimensionSpacePoint, SerializedPropertyValues $propertyValues): self + { + return new self($contentStreamId, $nodeAggregateId, $originDimensionSpacePoint, $propertyValues); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/PropertyValuesToWrite.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/PropertyValuesToWrite.php index 3e2d680288f..7befff99581 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/PropertyValuesToWrite.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/PropertyValuesToWrite.php @@ -33,6 +33,11 @@ private function __construct(public readonly array $values) { } + public static function createEmpty(): self + { + return new self([]); + } + /** * @param array $values */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValues.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValues.php index 41fe14085e9..5345f0bfd69 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValues.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValues.php @@ -43,6 +43,11 @@ private function __construct( $this->iterator = new \ArrayIterator($this->values); } + public static function createEmpty(): self + { + return new self([]); + } + /** * @param array $propertyValues */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/NodeModification.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/NodeModification.php index 5784bf8a4c0..93f87cb0714 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/NodeModification.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/NodeModification.php @@ -59,7 +59,7 @@ private function handleSetNodeProperties( $this->validateProperties($command->propertyValues, $nodeTypeName); - $lowLevelCommand = new SetSerializedNodeProperties( + $lowLevelCommand = SetSerializedNodeProperties::create( $command->contentStreamId, $command->nodeAggregateId, $command->originDimensionSpacePoint, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php index 9de86e0cfb5..cddcae970d7 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php @@ -47,48 +47,40 @@ final class MoveNodeAggregate implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( - /** - * The content stream in which the move operation is to be performed - */ + /** + * @param ContentStreamId $contentStreamId The content stream in which the move operation is to be performed + * @param DimensionSpacePoint $dimensionSpacePoint This is one of the *covered* dimension space points of the node aggregate and not necessarily one of the occupied ones. This allows us to move virtual specializations only when using the scatter strategy + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to move + * @param RelationDistributionStrategy $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}) + * @param NodeAggregateId|null $newParentNodeAggregateId The id of the new parent node aggregate. If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, even if the given siblings belong to other parents. In latter case, those siblings are ignored + * @param NodeAggregateId|null $newPrecedingSiblingNodeAggregateId The id of the new preceding sibling node aggregate. If given and no successor found, it is attempted to insert the moved nodes right after nodes of this aggregate. In dimension space points this aggregate does not cover, other siblings, in order of proximity, are tried to be used instead + * @param NodeAggregateId|null $newSucceedingSiblingNodeAggregateId The id of the new succeeding sibling node aggregate. If given, it is attempted to insert the moved nodes right before nodes of this aggregate. In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead + */ + private function __construct( public readonly ContentStreamId $contentStreamId, - /** - * This is one of the *covered* dimension space points of the node aggregate - * and not necessarily one of the occupied ones. - * This allows us to move virtual specializations only when using the scatter strategy. - */ public readonly DimensionSpacePoint $dimensionSpacePoint, - /** - * The node aggregate to be moved - */ public readonly NodeAggregateId $nodeAggregateId, - /** - * This is the id of the new parent node aggregate. - * If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, - * even if the given siblings belong to other parents. In latter case, those siblings are ignored. - */ + public readonly RelationDistributionStrategy $relationDistributionStrategy, public readonly ?NodeAggregateId $newParentNodeAggregateId, - /** - * This is the id of the new preceding sibling node aggregate. - * If given and no successor found, it is attempted to insert the moved nodes right after nodes of this - * aggregate. - * In dimension space points this aggregate does not cover, other siblings, - * in order of proximity, are tried to be used instead. - */ public readonly ?NodeAggregateId $newPrecedingSiblingNodeAggregateId, - /** - * This is the id of the new succeeding sibling node aggregate. - * If given, it is attempted to insert the moved nodes right before nodes of this aggregate. - * In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead. - */ public readonly ?NodeAggregateId $newSucceedingSiblingNodeAggregateId, - /** - * The relation distribution strategy to be used - */ - public readonly RelationDistributionStrategy $relationDistributionStrategy, ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the move operation is to be performed + * @param DimensionSpacePoint $dimensionSpacePoint This is one of the *covered* dimension space points of the node aggregate and not necessarily one of the occupied ones. This allows us to move virtual specializations only when using the scatter strategy + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to move + * @param RelationDistributionStrategy $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}) + * @param NodeAggregateId|null $newParentNodeAggregateId The id of the new parent node aggregate. If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, even if the given siblings belong to other parents. In latter case, those siblings are ignored + * @param NodeAggregateId|null $newPrecedingSiblingNodeAggregateId The id of the new preceding sibling node aggregate. If given and no successor found, it is attempted to insert the moved nodes right after nodes of this aggregate. In dimension space points this aggregate does not cover, other siblings, in order of proximity, are tried to be used instead + * @param NodeAggregateId|null $newSucceedingSiblingNodeAggregateId The id of the new succeeding sibling node aggregate. If given, it is attempted to insert the moved nodes right before nodes of this aggregate. In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead + */ + public static function create(ContentStreamId $contentStreamId, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, RelationDistributionStrategy $relationDistributionStrategy, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self + { + return new self($contentStreamId, $dimensionSpacePoint, $nodeAggregateId, $relationDistributionStrategy, $newParentNodeAggregateId, $newPrecedingSiblingNodeAggregateId, $newSucceedingSiblingNodeAggregateId); + } + /** * @param array $array */ @@ -98,6 +90,7 @@ public static function fromArray(array $array): self ContentStreamId::fromString($array['contentStreamId']), DimensionSpacePoint::fromArray($array['dimensionSpacePoint']), NodeAggregateId::fromString($array['nodeAggregateId']), + RelationDistributionStrategy::fromString($array['relationDistributionStrategy']), isset($array['newParentNodeAggregateId']) ? NodeAggregateId::fromString($array['newParentNodeAggregateId']) : null, @@ -107,7 +100,6 @@ public static function fromArray(array $array): self isset($array['newSucceedingSiblingNodeAggregateId']) ? NodeAggregateId::fromString($array['newSucceedingSiblingNodeAggregateId']) : null, - RelationDistributionStrategy::fromString($array['relationDistributionStrategy']), ); } @@ -125,10 +117,10 @@ public function createCopyForContentStream(ContentStreamId $target): self $target, $this->dimensionSpacePoint, $this->nodeAggregateId, + $this->relationDistributionStrategy, $this->newParentNodeAggregateId, $this->newPrecedingSiblingNodeAggregateId, $this->newSucceedingSiblingNodeAggregateId, - $this->relationDistributionStrategy, ); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php index 4d3b0561070..d0ea7f49e90 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetNodeReferences.php @@ -18,6 +18,13 @@ */ final class SetNodeReferences implements CommandInterface { + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $sourceNodeAggregateId The identifier of the node aggregate to set references + * @param OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint The dimension space for which the references should be set + * @param ReferenceName $referenceName Name of the reference to set + * @param NodeReferencesToWrite $references Unserialized reference(s) to set + */ public function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $sourceNodeAggregateId, @@ -26,4 +33,16 @@ public function __construct( public readonly NodeReferencesToWrite $references, ) { } + + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $sourceNodeAggregateId The identifier of the node aggregate to set references + * @param OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint The dimension space for which the references should be set + * @param ReferenceName $referenceName Name of the reference to set + * @param NodeReferencesToWrite $references Unserialized reference(s) to set + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $sourceNodeAggregateId, OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint, ReferenceName $referenceName, NodeReferencesToWrite $references): self + { + return new self($contentStreamId, $sourceNodeAggregateId, $sourceOriginDimensionSpacePoint, $referenceName, $references); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php index b711b9bd30d..9404160a980 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php @@ -37,7 +37,14 @@ final class SetSerializedNodeReferences implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $sourceNodeAggregateId The identifier of the node aggregate to set references + * @param OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint The dimension space for which the references should be set + * @param ReferenceName $referenceName Name of the reference to set + * @param SerializedNodeReferences $references Serialized reference(s) to set + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $sourceNodeAggregateId, public readonly OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint, @@ -46,6 +53,18 @@ public function __construct( ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $sourceNodeAggregateId The identifier of the node aggregate to set references + * @param OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint The dimension space for which the references should be set + * @param ReferenceName $referenceName Name of the reference to set + * @param SerializedNodeReferences $references Serialized reference(s) to set + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $sourceNodeAggregateId, OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint, ReferenceName $referenceName, SerializedNodeReferences $references): self + { + return new self($contentStreamId, $sourceNodeAggregateId, $sourceOriginDimensionSpacePoint, $referenceName, $references); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php index 8b22aa5ccae..e74797f6989 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php @@ -70,7 +70,7 @@ private function handleSetNodeReferences( } } - $lowLevelCommand = new SetSerializedNodeReferences( + $lowLevelCommand = SetSerializedNodeReferences::create( $command->contentStreamId, $command->sourceNodeAggregateId, $command->sourceOriginDimensionSpacePoint, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php index b1540c02434..060135a4f4e 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php @@ -32,6 +32,9 @@ final class RemoveNodeAggregate implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { + /** + * @param ContentStreamId $contentStreamId + */ public function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, @@ -51,10 +54,15 @@ public function __construct( * 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 = null + public readonly ?NodeAggregateId $removalAttachmentPoint ) { } + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self + { + return new self($contentStreamId, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy, null); + } + /** * @param array $array */ @@ -71,6 +79,15 @@ public static function fromArray(array $array): self ); } + /** + * @param NodeAggregateId $removalAttachmentPoint + * @internal + */ + public function withRemovalAttachmentPoint(NodeAggregateId $removalAttachmentPoint): self + { + return new self($this->contentStreamId, $this->nodeAggregateId, $this->coveredDimensionSpacePoint, $this->nodeVariantSelectionStrategy, $removalAttachmentPoint); + } + /** * @return array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php index 23d611a47af..a0839e3c880 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php @@ -35,13 +35,28 @@ final class ChangeNodeAggregateName implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to rename + * @param NodeName $newNodeName The new name of the node aggregate + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly NodeName $newNodeName, ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to rename + * @param NodeName $newNodeName The new name of the node aggregate + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, NodeName $newNodeName): self + { + return new self($contentStreamId, $nodeAggregateId, $newNodeName); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php index eab3b53fbeb..d4cd304a9f4 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php @@ -37,23 +37,33 @@ final class ChangeNodeAggregateType implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the operation is to be performed + * @param NodeAggregateId $nodeAggregateId The unique identifier of the node aggregate to change + * @param NodeTypeName $newNodeTypeName Name of the new node type + * @param NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy $strategy Strategy for conflicts on affected child nodes ({@see NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy}) + * @param NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds Predefined aggregate ids of any tethered child nodes for the new node type per path. For any tethered node that has no matching entry in this set, the node aggregate id is generated randomly. Since tethered nodes may have tethered child nodes themselves, this works for multiple levels ({@see self::withTetheredDescendantNodeAggregateIds()}) + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly NodeTypeName $newNodeTypeName, public readonly NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy $strategy, - /** - * NodeAggregateIds for tethered descendants (optional). - * - * If the given node type declares tethered child nodes, you may predefine their node aggregate ids - * using this assignment registry. - * Since tethered child nodes may have tethered child nodes themselves, - * this registry is indexed using relative node paths to the node to create in the first place. - */ - public readonly ?NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds = null + public readonly NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds, ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the operation is to be performed + * @param NodeAggregateId $nodeAggregateId The unique identifier of the node aggregate to change + * @param NodeTypeName $newNodeTypeName Name of the new node type + * @param NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy $strategy Strategy for conflicts on affected child nodes ({@see NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy}) + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, NodeTypeName $newNodeTypeName, NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy $strategy): self + { + return new self($contentStreamId, $nodeAggregateId, $newNodeTypeName, $strategy, NodeAggregateIdsByNodePaths::createEmpty()); + } + /** * @param array $array */ @@ -66,7 +76,7 @@ public static function fromArray(array $array): self NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy::from($array['strategy']), isset($array['tetheredDescendantNodeAggregateIds']) ? NodeAggregateIdsByNodePaths::fromArray($array['tetheredDescendantNodeAggregateIds']) - : null + : NodeAggregateIdsByNodePaths::createEmpty() ); } @@ -106,9 +116,8 @@ public function jsonSerialize(): array * * Is needed to make this command fully deterministic before storing it at the events. */ - public function withTetheredDescendantNodeAggregateIds( - NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds - ): self { + public function withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds): self + { return new self( $this->contentStreamId, $this->nodeAggregateId, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php index 6db1e898724..f174092536a 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php @@ -207,7 +207,7 @@ private function handleChangeNodeAggregateType( ); if ($tetheredNode === null) { $tetheredNodeAggregateId = $command->tetheredDescendantNodeAggregateIds - ?->getNodeAggregateId(NodePath::fromString($tetheredNodeName->value)) + ->getNodeAggregateId(NodePath::fromString($tetheredNodeName->value)) ?: NodeAggregateId::create(); array_push($events, ...iterator_to_array($this->createEventsForMissingTetheredNode( $nodeAggregate, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php index a31a1d65484..d9660530e07 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php @@ -35,7 +35,13 @@ final class CreateNodeVariant implements RebasableToOtherContentStreamsInterface, MatchableWithNodeIdToPublishOrDiscardInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the affected node aggregate + * @param OriginDimensionSpacePoint $sourceOrigin Dimension Space Point from which the node is to be copied from + * @param OriginDimensionSpacePoint $targetOrigin Dimension Space Point to which the node is to be copied to + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly OriginDimensionSpacePoint $sourceOrigin, @@ -43,6 +49,17 @@ public function __construct( ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the create operation is to be performed + * @param NodeAggregateId $nodeAggregateId The identifier of the affected node aggregate + * @param OriginDimensionSpacePoint $sourceOrigin Dimension Space Point from which the node is to be copied from + * @param OriginDimensionSpacePoint $targetOrigin Dimension Space Point to which the node is to be copied to + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, OriginDimensionSpacePoint $sourceOrigin, OriginDimensionSpacePoint $targetOrigin): self + { + return new self($contentStreamId, $nodeAggregateId, $sourceOrigin, $targetOrigin); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php index 0cd4720d6ff..ec57b71854f 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php +++ b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php @@ -33,13 +33,29 @@ final class CreateRootNodeAggregateWithNode implements \JsonSerializable, RebasableToOtherContentStreamsInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream in which the root node should be created in + * @param NodeAggregateId $nodeAggregateId The id of the root node aggregate to create + * @param NodeTypeName $nodeTypeName Name of type of the new node to create + */ + private function __construct( public readonly ContentStreamId $contentStreamId, public readonly NodeAggregateId $nodeAggregateId, public readonly NodeTypeName $nodeTypeName, ) { } + /** + * @param ContentStreamId $contentStreamId The content stream in which the root node should be created in + * @param NodeAggregateId $nodeAggregateId The id of the root node aggregate to create + * @param NodeTypeName $nodeTypeName Name of type of the new node to create + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName): self + { + return new self($contentStreamId, $nodeAggregateId, $nodeTypeName); + } + + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php index 1c743b08a5e..5e1498731f3 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php +++ b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php @@ -31,12 +31,25 @@ final class UpdateRootNodeAggregateDimensions implements \JsonSerializable, RebasableToOtherContentStreamsInterface { - public function __construct( + /** + * @param ContentStreamId $contentStreamId The content stream which the dimensions should be updated in + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate that should be updated + */ + private function __construct( public readonly ContentStreamId $contentStreamId, - public readonly NodeAggregateId $nodeAggregateId + public readonly NodeAggregateId $nodeAggregateId, ) { } + /** + * @param ContentStreamId $contentStreamId The content stream which the dimensions should be updated in + * @param NodeAggregateId $nodeAggregateId The id of the node aggregate that should be updated + */ + public static function create(ContentStreamId $contentStreamId, NodeAggregateId $nodeAggregateId): self + { + return new self($contentStreamId, $nodeAggregateId); + } + /** * @param array $array */ diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 9e059f91423..d3bd1557328 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -139,7 +139,7 @@ private function handleCreateWorkspace( // When the workspace is created, we first have to fork the content stream $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $command->newContentStreamId, $baseWorkspace->currentContentStreamId, ) @@ -205,7 +205,7 @@ private function handleCreateRootWorkspace( $newContentStreamId = $command->newContentStreamId; $contentRepository->handle( - new CreateContentStream( + CreateContentStream::create( $newContentStreamId, ) )->block(); @@ -250,7 +250,7 @@ private function handlePublishWorkspace( // After publishing a workspace, we need to again fork from Base. $newContentStream = ContentStreamId::create(); $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $newContentStream, $baseWorkspace->currentContentStreamId, ) @@ -367,7 +367,7 @@ private function handleRebaseWorkspace( // - extract the commands from the to-be-rebased content stream; and applies them on the new content stream $rebasedContentStream = $command->rebasedContentStreamId; $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $rebasedContentStream, $baseWorkspace->currentContentStreamId, ) @@ -529,7 +529,7 @@ private function handlePublishIndividualNodesFromWorkspace( // 2) fork a new contentStream, based on the base WS, and apply MATCHING $matchingContentStream = $command->contentStreamIdForMatchingPart; $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $matchingContentStream, $baseWorkspace->currentContentStreamId, ) @@ -549,7 +549,7 @@ private function handlePublishIndividualNodesFromWorkspace( // 3) fork a new contentStream, based on the matching content stream, and apply REST $remainingContentStream = $command->contentStreamIdForRemainingPart; $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $remainingContentStream, $matchingContentStream, ) @@ -590,7 +590,7 @@ private function handlePublishIndividualNodesFromWorkspace( // to avoid dangling content streams, we need to remove our temporary content stream (whose events // have already been published) - $contentRepository->handle(new RemoveContentStream( + $contentRepository->handle(RemoveContentStream::create( $matchingContentStream )); @@ -645,7 +645,7 @@ private function handleDiscardIndividualNodesFromWorkspace( // 2) fork a new contentStream, based on the base WS, and apply the commands to keep $newContentStream = $command->newContentStreamId; $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $newContentStream, $baseWorkspace->currentContentStreamId, ) @@ -711,7 +711,7 @@ private function handleDiscardWorkspace( $newContentStream = $command->newContentStreamId; $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $newContentStream, $baseWorkspace->currentContentStreamId, ) @@ -757,7 +757,7 @@ private function handleChangeBaseWorkspace( $this->requireNonCircularRelationBetweenWorkspaces($workspace, $baseWorkspace, $contentRepository); $contentRepository->handle( - new ForkContentStream( + ForkContentStream::create( $command->newContentStreamId, $baseWorkspace->currentContentStreamId, ) @@ -789,7 +789,7 @@ private function handleDeleteWorkspace( $workspace = $this->requireWorkspace($command->workspaceName, $contentRepository); $contentRepository->handle( - new RemoveContentStream( + RemoveContentStream::create( $workspace->currentContentStreamId ) )->block(); diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateRootWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateRootWorkspace.php index 9187d3bce5d..82b6adaf2b9 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateRootWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateRootWorkspace.php @@ -29,11 +29,28 @@ */ final class CreateRootWorkspace implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Unique name of the workspace to create + * @param WorkspaceTitle $workspaceTitle Human-readable title of the workspace to create (can be changed) + * @param WorkspaceDescription $workspaceDescription Description of the workspace to create (can be changed) + * @param ContentStreamId $newContentStreamId The id of the content stream the new workspace is assigned to initially + */ + private function __construct( public readonly WorkspaceName $workspaceName, public readonly WorkspaceTitle $workspaceTitle, public readonly WorkspaceDescription $workspaceDescription, public readonly ContentStreamId $newContentStreamId ) { } + + /** + * @param WorkspaceName $workspaceName Name of the workspace to create + * @param WorkspaceTitle $workspaceTitle Human-readable title of the workspace to create (can be changed) + * @param WorkspaceDescription $workspaceDescription Description of the workspace to create (can be changed) + * @param ContentStreamId $newContentStreamId The id of the content stream the new workspace is assigned to initially + */ + public static function create(WorkspaceName $workspaceName, WorkspaceTitle $workspaceTitle, WorkspaceDescription $workspaceDescription, ContentStreamId $newContentStreamId): self + { + return new self($workspaceName, $workspaceTitle, $workspaceDescription, $newContentStreamId); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateWorkspace.php index 4bfb71c08f6..9971f046acd 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Command/CreateWorkspace.php @@ -28,17 +28,34 @@ */ final class CreateWorkspace implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Unique name of the workspace to create + * @param WorkspaceName $baseWorkspaceName Name of the base workspace + * @param WorkspaceTitle $workspaceTitle Human-readable title of the workspace to create (can be changed) + * @param WorkspaceDescription $workspaceDescription Description of the workspace to create (can be changed) + * @param ContentStreamId $newContentStreamId The id of the content stream the new workspace is assigned to initially + * @param UserId|null $workspaceOwner Owner of the new workspace (optional) + */ + private function __construct( public readonly WorkspaceName $workspaceName, public readonly WorkspaceName $baseWorkspaceName, public readonly WorkspaceTitle $workspaceTitle, public readonly WorkspaceDescription $workspaceDescription, - /** - * the content stream identifier for the content stream which is created together with the to-be-created - * workspace - */ public readonly ContentStreamId $newContentStreamId, - public readonly ?UserId $workspaceOwner = null + public readonly ?UserId $workspaceOwner, ) { } + + /** + * @param WorkspaceName $workspaceName Unique name of the workspace to create + * @param WorkspaceName $baseWorkspaceName Name of the base workspace + * @param WorkspaceTitle $workspaceTitle Human-readable title of the workspace to create (can be changed) + * @param WorkspaceDescription $workspaceDescription Description of the workspace to create (can be changed) + * @param ContentStreamId $newContentStreamId The id of the content stream the new workspace is assigned to initially + * @param UserId|null $workspaceOwner Owner of the new workspace (optional) + */ + public static function create(WorkspaceName $workspaceName, WorkspaceName $baseWorkspaceName, WorkspaceTitle $workspaceTitle, WorkspaceDescription $workspaceDescription, ContentStreamId $newContentStreamId, ?UserId $workspaceOwner = null): self + { + return new self($workspaceName, $baseWorkspaceName, $workspaceTitle, $workspaceDescription, $newContentStreamId, $workspaceOwner); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeBaseWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeBaseWorkspace.php index c20569fb843..16bf8773721 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeBaseWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeBaseWorkspace.php @@ -15,10 +15,24 @@ */ final class ChangeBaseWorkspace implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Name of the affected workspace + * @param WorkspaceName $baseWorkspaceName Name of the new base workspace + * @param ContentStreamId $newContentStreamId The id of the new content stream id that will be assigned to the workspace + */ + private function __construct( public readonly WorkspaceName $workspaceName, public readonly WorkspaceName $baseWorkspaceName, public readonly ContentStreamId $newContentStreamId, ) { } + + /** + * @param WorkspaceName $workspaceName Name of the affected workspace + * @param WorkspaceName $baseWorkspaceName Name of the new base workspace + */ + public static function create(WorkspaceName $workspaceName, WorkspaceName $baseWorkspaceName): self + { + return new self($workspaceName, $baseWorkspaceName, ContentStreamId::create()); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeWorkspaceOwner.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeWorkspaceOwner.php index 9b018d258e3..228321c4cfe 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeWorkspaceOwner.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/ChangeWorkspaceOwner.php @@ -15,9 +15,22 @@ */ final class ChangeWorkspaceOwner implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Name of the workspace to change the owner for + * @param string|null $newWorkspaceOwner The id of the new workspace owner or NULL to remove the owner + */ + private function __construct( public readonly WorkspaceName $workspaceName, public readonly ?string $newWorkspaceOwner, ) { } + + /** + * @param WorkspaceName $workspaceName Name of the workspace to change the owner for + * @param string|null $newWorkspaceOwner The id of the new workspace owner or NULL to remove the owner + */ + public static function create(WorkspaceName $workspaceName, ?string $newWorkspaceOwner): self + { + return new self($workspaceName, $newWorkspaceOwner); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/DeleteWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/DeleteWorkspace.php index 3def28f9325..f685b459506 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/DeleteWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/DeleteWorkspace.php @@ -14,8 +14,19 @@ */ final class DeleteWorkspace implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Name of the workspace to delete + */ + private function __construct( public readonly WorkspaceName $workspaceName, ) { } + + /** + * @param WorkspaceName $workspaceName Name of the workspace to delete + */ + public static function create(WorkspaceName $workspaceName): self + { + return new self($workspaceName); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/RenameWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/RenameWorkspace.php index 6fec762b26b..4f2fc517517 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/RenameWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceModification/Command/RenameWorkspace.php @@ -16,10 +16,25 @@ */ final class RenameWorkspace implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Name of the workspace to rename + * @param WorkspaceTitle $workspaceTitle New title of the workspace + * @param WorkspaceDescription $workspaceDescription New description of the workspace + */ + private function __construct( public readonly WorkspaceName $workspaceName, public readonly WorkspaceTitle $workspaceTitle, public readonly WorkspaceDescription $workspaceDescription, ) { } + + /** + * @param WorkspaceName $workspaceName Name of the workspace to rename + * @param WorkspaceTitle $workspaceTitle New title of the workspace + * @param WorkspaceDescription $workspaceDescription New description of the workspace + */ + public static function create(WorkspaceName $workspaceName, WorkspaceTitle $workspaceTitle, WorkspaceDescription $workspaceDescription): self + { + return new self($workspaceName, $workspaceTitle, $workspaceDescription); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardIndividualNodesFromWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardIndividualNodesFromWorkspace.php index efb5e66e693..44b3e6d4b24 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardIndividualNodesFromWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardIndividualNodesFromWorkspace.php @@ -17,7 +17,6 @@ use Neos\ContentRepository\Core\CommandHandler\CommandInterface; use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdsToPublishOrDiscard; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; -use Neos\ContentRepository\Core\SharedModel\User\UserId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -27,17 +26,22 @@ */ final class DiscardIndividualNodesFromWorkspace implements CommandInterface { + /** + * @param WorkspaceName $workspaceName Name of the affected workspace + * @param NodeIdsToPublishOrDiscard $nodesToDiscard Ids of the nodes to be discarded + * @param ContentStreamId $newContentStreamId The id of the new content stream, that will contain the remaining changes which were not discarded + */ private function __construct( public readonly WorkspaceName $workspaceName, public readonly NodeIdsToPublishOrDiscard $nodesToDiscard, - /** - * Content Stream Id of the newly created fork, which contains the remaining changes which were - * not removed - */ public readonly ContentStreamId $newContentStreamId ) { } + /** + * @param WorkspaceName $workspaceName Name of the affected workspace + * @param NodeIdsToPublishOrDiscard $nodesToDiscard Ids of the nodes to be discarded + */ public static function create( WorkspaceName $workspaceName, NodeIdsToPublishOrDiscard $nodesToDiscard, @@ -52,11 +56,8 @@ public static function create( /** * Call this method if you want to run this command fully deterministically, f.e. during test cases */ - public static function createFullyDeterministic( - WorkspaceName $workspaceName, - NodeIdsToPublishOrDiscard $nodesToDiscard, - ContentStreamId $newContentStreamId - ): self { - return new self($workspaceName, $nodesToDiscard, $newContentStreamId); + public function withNewContentStreamId(ContentStreamId $newContentStreamId): self + { + return new self($this->workspaceName, $this->nodesToDiscard, $newContentStreamId); } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardWorkspace.php index 465394eeded..3e05fe9086b 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/DiscardWorkspace.php @@ -25,16 +25,19 @@ */ final class DiscardWorkspace implements CommandInterface { + /** + * @param WorkspaceName $workspaceName Name of the affected workspace + * @param ContentStreamId $newContentStreamId The id of the newly created content stream that will contain the remaining changes that were not discarded + */ private function __construct( public readonly WorkspaceName $workspaceName, - /** - * Content Stream ID of the newly created fork, which contains the remaining changes - * which were not removed - */ public readonly ContentStreamId $newContentStreamId ) { } + /** + * @param WorkspaceName $workspaceName Name of the affected workspace + */ public static function create(WorkspaceName $workspaceName): self { return new self($workspaceName, ContentStreamId::create()); @@ -43,10 +46,8 @@ public static function create(WorkspaceName $workspaceName): self /** * Call this method if you want to run this command fully deterministically, f.e. during test cases */ - public static function createFullyDeterministic( - WorkspaceName $workspaceName, - ContentStreamId $newContentStreamId - ): self { - return new self($workspaceName, $newContentStreamId); + public function withNewContentStreamId(ContentStreamId $newContentStreamId): self + { + return new self($this->workspaceName, $newContentStreamId); } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php index 6b26dd1a4f8..873d00e5925 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishIndividualNodesFromWorkspace.php @@ -26,6 +26,12 @@ */ 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 + */ private function __construct( public readonly WorkspaceName $workspaceName, public readonly NodeIdsToPublishOrDiscard $nodesToPublish, @@ -50,10 +56,12 @@ private function __construct( ) { } - public static function create( - WorkspaceName $workspaceName, - NodeIdsToPublishOrDiscard $nodesToPublish, - ): self { + /** + * @param WorkspaceName $workspaceName Name of the affected workspace + * @param NodeIdsToPublishOrDiscard $nodesToPublish Ids of the nodes to publish or discard + */ + public static function create(WorkspaceName $workspaceName, NodeIdsToPublishOrDiscard $nodesToPublish): self + { return new self( $workspaceName, $nodesToPublish, @@ -62,20 +70,13 @@ public static function create( ); } - /** - * Call this method if you want to run this command fully deterministically, f.e. during test cases - */ - public static function createFullyDeterministic( - WorkspaceName $workspaceName, - NodeIdsToPublishOrDiscard $nodesToPublish, - ContentStreamId $contentStreamIdForMatchingPart, - ContentStreamId $contentStreamIdForRemainingPart - ): self { - return new self( - $workspaceName, - $nodesToPublish, - $contentStreamIdForMatchingPart, - $contentStreamIdForRemainingPart - ); + public function withContentStreamIdForMatchingPart(ContentStreamId $contentStreamIdForMatchingPart): self + { + return new self($this->workspaceName, $this->nodesToPublish, $contentStreamIdForMatchingPart, $this->contentStreamIdForRemainingPart); + } + + public function withContentStreamIdForRemainingPart(ContentStreamId $contentStreamIdForRemainingPart): self + { + return new self($this->workspaceName, $this->nodesToPublish, $this->contentStreamIdForMatchingPart, $contentStreamIdForRemainingPart); } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishWorkspace.php index 74a070d3cc2..8d905ea5747 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspacePublication/Command/PublishWorkspace.php @@ -24,8 +24,19 @@ */ final class PublishWorkspace implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Name of the workspace to publish + */ + private function __construct( public readonly WorkspaceName $workspaceName, ) { } + + /** + * @param WorkspaceName $workspaceName Name of the workspace to publish + */ + public static function create(WorkspaceName $workspaceName): self + { + return new self($workspaceName); + } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceRebase/Command/RebaseWorkspace.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceRebase/Command/RebaseWorkspace.php index b7f673cc1f4..dc3a67382f4 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceRebase/Command/RebaseWorkspace.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceRebase/Command/RebaseWorkspace.php @@ -25,11 +25,12 @@ */ final class RebaseWorkspace implements CommandInterface { - public function __construct( + /** + * @param WorkspaceName $workspaceName Name of the workspace that should be rebased + * @param ContentStreamId $rebasedContentStreamId The id of the new content stream which is created during the rebase + */ + private function __construct( public readonly WorkspaceName $workspaceName, - /** - * Name of the new content stream which is created during the rebase - */ public readonly ContentStreamId $rebasedContentStreamId ) { } @@ -42,10 +43,8 @@ public static function create(WorkspaceName $workspaceName): self /** * Call this method if you want to run this command fully deterministically, f.e. during test cases */ - public static function createFullyDeterministic( - WorkspaceName $workspaceName, - ContentStreamId $newContentStreamId - ): self { - return new self($workspaceName, $newContentStreamId); + public function withRebasedContentStreamId(ContentStreamId $newContentStreamId): self + { + return new self($this->workspaceName, $newContentStreamId); } } diff --git a/Neos.ContentRepository.Core/Classes/Service/ContentRepositoryBootstrapper.php b/Neos.ContentRepository.Core/Classes/Service/ContentRepositoryBootstrapper.php index 6ea64f0a216..578fe1c1eb3 100644 --- a/Neos.ContentRepository.Core/Classes/Service/ContentRepositoryBootstrapper.php +++ b/Neos.ContentRepository.Core/Classes/Service/ContentRepositoryBootstrapper.php @@ -46,7 +46,7 @@ public function getOrCreateLiveContentStream(): ContentStreamId } $liveContentStreamId = ContentStreamId::create(); $this->contentRepository->handle( - new CreateRootWorkspace( + CreateRootWorkspace::create( WorkspaceName::forLive(), WorkspaceTitle::fromString('Live'), WorkspaceDescription::fromString('Public live workspace'), @@ -73,7 +73,7 @@ public function getOrCreateRootNodeAggregate( // TODO make this case more explicit } catch (\Exception $exception) { $rootNodeAggregateId = NodeAggregateId::create(); - $this->contentRepository->handle(new CreateRootNodeAggregateWithNode( + $this->contentRepository->handle(CreateRootNodeAggregateWithNode::create( $contentStreamId, $rootNodeAggregateId, $rootNodeTypeName, diff --git a/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php b/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php index 8ae0894a1ac..7868fbe0522 100644 --- a/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php +++ b/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php @@ -52,9 +52,7 @@ public function prune(bool $removeTemporary = false): iterable foreach ($unusedContentStreams as $contentStream) { $this->lastCommandResult = $this->contentRepository->handle( - new RemoveContentStream( - $contentStream, - ) + RemoveContentStream::create($contentStream) ); } diff --git a/Neos.ContentRepository.Core/Tests/Unit/Projection/ContentGraph/PropertyCollectionTest.php b/Neos.ContentRepository.Core/Tests/Unit/Projection/ContentGraph/PropertyCollectionTest.php index 60d32c7ecdc..ec3fb6f6b30 100644 --- a/Neos.ContentRepository.Core/Tests/Unit/Projection/ContentGraph/PropertyCollectionTest.php +++ b/Neos.ContentRepository.Core/Tests/Unit/Projection/ContentGraph/PropertyCollectionTest.php @@ -36,7 +36,7 @@ public function setUp(): void public function emptyPropertyCollectionReturnsEmptyArray(): void { $this->mockSerializer->expects($this->never())->method($this->anything()); - $collection = new PropertyCollection(SerializedPropertyValues::fromArray([]), $this->mockPropertyConverter); + $collection = new PropertyCollection(SerializedPropertyValues::createEmpty(), $this->mockPropertyConverter); self::assertSame([], iterator_to_array($collection)); } @@ -85,7 +85,7 @@ public function propertiesCanBeIterated(): void */ public function offsetSetThrowsAnException(): void { - $collection = new PropertyCollection(SerializedPropertyValues::fromArray([]), $this->mockPropertyConverter); + $collection = new PropertyCollection(SerializedPropertyValues::createEmpty(), $this->mockPropertyConverter); $this->expectException(\RuntimeException::class); $collection->offsetSet('foo', 'bar'); } @@ -95,7 +95,7 @@ public function offsetSetThrowsAnException(): void */ public function offsetUnsetThrowsAnException(): void { - $collection = new PropertyCollection(SerializedPropertyValues::fromArray([]), $this->mockPropertyConverter); + $collection = new PropertyCollection(SerializedPropertyValues::createEmpty(), $this->mockPropertyConverter); $this->expectException(\RuntimeException::class); $collection->offsetUnset('foo'); } diff --git a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php index eb39817b7ff..57296c6aa65 100644 --- a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php +++ b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php @@ -71,7 +71,7 @@ public function executeMigration(ExecuteMigration $command): void foreach ($command->getMigrationConfiguration()->getMigration() as $step => $migrationDescription) { $contentStreamForWriting = $command->getOrCreateContentStreamIdForWriting($step); $this->contentRepository->handle( - new CreateWorkspace( + CreateWorkspace::create( WorkspaceName::fromString($contentStreamForWriting->value), $workspace->workspaceName, WorkspaceTitle::fromString($contentStreamForWriting->value), diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php index ca215ab29df..c3d397da3ca 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php @@ -53,7 +53,7 @@ public function execute( ContentStreamId $contentStreamForWriting ): CommandResult { return $this->contentRepository->handle( - new AddDimensionShineThrough( + AddDimensionShineThrough::create( $contentStreamForWriting, $this->from, $this->to diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php index 05f16267399..72a23fd9db8 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php @@ -60,7 +60,7 @@ public function execute( ): ?CommandResult { if (!$node->hasProperty($this->newPropertyName)) { return $this->contentRepository->handle( - new SetSerializedNodeProperties( + SetSerializedNodeProperties::create( $contentStreamForWriting, $node->nodeAggregateId, $node->originDimensionSpacePoint, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php index 11a230e74fd..13eed059459 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php @@ -65,7 +65,7 @@ public function execute( NodeAggregate $nodeAggregate, ContentStreamId $contentStreamForWriting ): CommandResult { - return $this->contentRepository->handle(new ChangeNodeAggregateType( + return $this->contentRepository->handle(ChangeNodeAggregateType::create( $contentStreamForWriting, $nodeAggregate->nodeAggregateId, NodeTypeName::fromString($this->newType), diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/ChangePropertyValueTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/ChangePropertyValueTransformationFactory.php index c5b76d43218..2512f716ee6 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/ChangePropertyValueTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/ChangePropertyValueTransformationFactory.php @@ -131,7 +131,7 @@ public function execute( ); return $this->contentRepository->handle( - new SetSerializedNodeProperties( + SetSerializedNodeProperties::create( $contentStreamForWriting, $node->nodeAggregateId, $node->originDimensionSpacePoint, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php index b5726942dc0..4ebbdd69f36 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php @@ -51,7 +51,7 @@ public function execute( ContentStreamId $contentStreamForWriting ): CommandResult { return $this->contentRepository->handle( - new MoveDimensionSpacePoint( + MoveDimensionSpacePoint::create( $contentStreamForWriting, $this->from, $this->to diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php index 74611668a30..6b0e2595c16 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php @@ -86,7 +86,7 @@ public function execute( return null; } - return $this->contentRepository->handle(new RemoveNodeAggregate( + return $this->contentRepository->handle(RemoveNodeAggregate::create( $contentStreamForWriting, $node->nodeAggregateId, $coveredDimensionSpacePoint, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php index 9dc3d7c2fe2..845067f506f 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php @@ -55,7 +55,7 @@ public function execute( ): ?CommandResult { if ($node->hasProperty($this->propertyName)) { return $this->contentRepository->handle( - new SetSerializedNodeProperties( + SetSerializedNodeProperties::create( $contentStreamForWriting, $node->nodeAggregateId, $node->originDimensionSpacePoint, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php index ddd468095f2..0a362e82dad 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php @@ -50,7 +50,7 @@ public function execute( NodeAggregate $nodeAggregate, ContentStreamId $contentStreamForWriting ): CommandResult { - return $this->contentRepository->handle(new ChangeNodeAggregateName( + return $this->contentRepository->handle(ChangeNodeAggregateName::create( $contentStreamForWriting, $nodeAggregate->nodeAggregateId, NodeName::fromString($this->newNodeName), diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/RenamePropertyTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/RenamePropertyTransformationFactory.php index 3772ebb53ac..e20ab2d7298 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RenamePropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RenamePropertyTransformationFactory.php @@ -67,7 +67,7 @@ public function execute( /** @var PropertyCollectionInterface $properties */ $properties = $node->properties; return $this->contentRepository->handle( - new SetSerializedNodeProperties( + SetSerializedNodeProperties::create( $contentStreamForWriting, $node->nodeAggregateId, $node->originDimensionSpacePoint, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php index a59ccae6cee..a617713c9ed 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php @@ -69,7 +69,7 @@ public function execute( } $newValue = strip_tags($propertyValue); return $this->contentRepository->handle( - new SetSerializedNodeProperties( + SetSerializedNodeProperties::create( $contentStreamForWriting, $node->nodeAggregateId, $node->originDimensionSpacePoint, diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/ContentStreamForking.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/ContentStreamForking.php index 1692662c097..750d5369b83 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/ContentStreamForking.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/ContentStreamForking.php @@ -40,7 +40,7 @@ public function theCommandForkContentStreamIsExecutedWithPayload(TableNode $payl ? ContentStreamId::fromString($commandArguments['sourceContentStreamId']) : $this->currentContentStreamId; - $command = new ForkContentStream( + $command = ForkContentStream::create( ContentStreamId::fromString($commandArguments['contentStreamId']), $sourceContentStreamId, ); diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeCreation.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeCreation.php index 549adb984bf..51c82feb566 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeCreation.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeCreation.php @@ -59,7 +59,7 @@ public function theCommandCreateRootNodeAggregateWithNodeIsExecutedWithPayload(T : $this->currentContentStreamId; $nodeAggregateId = NodeAggregateId::fromString($commandArguments['nodeAggregateId']); - $command = new CreateRootNodeAggregateWithNode( + $command = CreateRootNodeAggregateWithNode::create( $contentStreamId, $nodeAggregateId, NodeTypeName::fromString($commandArguments['nodeTypeName']), @@ -115,7 +115,7 @@ public function theCommandUpdateRootNodeAggregateDimensionsIsExecutedWithPayload : $this->currentContentStreamId; $nodeAggregateId = NodeAggregateId::fromString($commandArguments['nodeAggregateId']); - $command = new UpdateRootNodeAggregateDimensions( + $command = UpdateRootNodeAggregateDimensions::create( $contentStreamId, $nodeAggregateId, ); @@ -138,7 +138,7 @@ public function theCommandCreateNodeAggregateWithNodeIsExecutedWithPayload(Table ? OriginDimensionSpacePoint::fromArray($commandArguments['originDimensionSpacePoint']) : OriginDimensionSpacePoint::fromDimensionSpacePoint($this->currentDimensionSpacePoint); - $command = new CreateNodeAggregateWithNode( + $command = CreateNodeAggregateWithNode::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), NodeTypeName::fromString($commandArguments['nodeTypeName']), @@ -153,11 +153,10 @@ public function theCommandCreateNodeAggregateWithNodeIsExecutedWithPayload(Table isset($commandArguments['initialPropertyValues']) ? $this->deserializeProperties($commandArguments['initialPropertyValues']) : null, - isset($commandArguments['tetheredDescendantNodeAggregateIds']) - ? NodeAggregateIdsByNodePaths::fromArray($commandArguments['tetheredDescendantNodeAggregateIds']) - : null ); - + if (isset($commandArguments['tetheredDescendantNodeAggregateIds'])) { + $command = $command->withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths::fromArray($commandArguments['tetheredDescendantNodeAggregateIds'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } @@ -186,7 +185,7 @@ public function theFollowingCreateNodeAggregateWithNodeCommandsAreExecuted(Table $originDimensionSpacePoint = isset($row['originDimensionSpacePoint']) ? OriginDimensionSpacePoint::fromJsonString($row['originDimensionSpacePoint']) : OriginDimensionSpacePoint::fromDimensionSpacePoint($this->currentDimensionSpacePoint); - $command = new CreateNodeAggregateWithNode( + $command = CreateNodeAggregateWithNode::create( $contentStreamId, NodeAggregateId::fromString($row['nodeAggregateId']), NodeTypeName::fromString($row['nodeTypeName']), @@ -201,10 +200,10 @@ public function theFollowingCreateNodeAggregateWithNodeCommandsAreExecuted(Table isset($row['initialPropertyValues']) ? $this->parsePropertyValuesJsonString($row['initialPropertyValues']) : null, - isset($row['tetheredDescendantNodeAggregateIds']) - ? NodeAggregateIdsByNodePaths::fromJsonString($row['tetheredDescendantNodeAggregateIds']) - : null ); + if (isset($row['tetheredDescendantNodeAggregateIds'])) { + $command = $command->withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths::fromJsonString($row['tetheredDescendantNodeAggregateIds'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); $this->theGraphProjectionIsFullyUpToDate(); } @@ -232,7 +231,7 @@ public function theCommandCreateNodeAggregateWithNodeAndSerializedPropertiesIsEx ? OriginDimensionSpacePoint::fromArray($commandArguments['originDimensionSpacePoint']) : OriginDimensionSpacePoint::fromDimensionSpacePoint($this->currentDimensionSpacePoint); - $command = new CreateNodeAggregateWithNodeAndSerializedProperties( + $command = CreateNodeAggregateWithNodeAndSerializedProperties::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), NodeTypeName::fromString($commandArguments['nodeTypeName']), @@ -246,12 +245,11 @@ public function theCommandCreateNodeAggregateWithNodeAndSerializedPropertiesIsEx : null, isset($commandArguments['initialPropertyValues']) ? SerializedPropertyValues::fromArray($commandArguments['initialPropertyValues']) - : null, - isset($commandArguments['tetheredDescendantNodeAggregateIds']) - ? NodeAggregateIdsByNodePaths::fromArray($commandArguments['tetheredDescendantNodeAggregateIds']) : null ); - + if (isset($commandArguments['tetheredDescendantNodeAggregateIds'])) { + $command = $command->withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths::fromArray($commandArguments['tetheredDescendantNodeAggregateIds'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeDisabling.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeDisabling.php index 38058b4cdf1..a794a506c34 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeDisabling.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeDisabling.php @@ -51,7 +51,7 @@ public function theCommandDisableNodeAggregateIsExecutedWithPayload(TableNode $p ? DimensionSpacePoint::fromArray($commandArguments['coveredDimensionSpacePoint']) : $this->currentDimensionSpacePoint; - $command = new DisableNodeAggregate( + $command = DisableNodeAggregate::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), $coveredDimensionSpacePoint, @@ -125,7 +125,7 @@ public function theCommandEnableNodeAggregateIsExecutedWithPayload(TableNode $pa ? DimensionSpacePoint::fromArray($commandArguments['coveredDimensionSpacePoint']) : $this->currentDimensionSpacePoint; - $command = new EnableNodeAggregate( + $command = EnableNodeAggregate::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), $coveredDimensionSpacePoint, diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeModification.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeModification.php index 14646196ac0..61296835fd7 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeModification.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeModification.php @@ -50,7 +50,7 @@ public function theCommandSetPropertiesIsExecutedWithPayload(TableNode $payloadT $commandArguments['originDimensionSpacePoint'] = $this->currentDimensionSpacePoint->jsonSerialize(); } - $command = new SetNodeProperties( + $command = SetNodeProperties::create( ContentStreamId::fromString($commandArguments['contentStreamId']), NodeAggregateId::fromString($commandArguments['nodeAggregateId']), OriginDimensionSpacePoint::fromArray($commandArguments['originDimensionSpacePoint']), diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeMove.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeMove.php index acf108b8897..e785fd6d011 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeMove.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeMove.php @@ -62,14 +62,14 @@ public function theCommandMoveNodeIsExecutedWithPayload(TableNode $payloadTable) $commandArguments['relationDistributionStrategy'] ?? null ); - $command = new MoveNodeAggregate( + $command = MoveNodeAggregate::create( $contentStreamId, $dimensionSpacePoint, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), + $relationDistributionStrategy, $newParentNodeAggregateId, $newPrecedingSiblingNodeAggregateId, $newSucceedingSiblingNodeAggregateId, - $relationDistributionStrategy, ); $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeRemoval.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeRemoval.php index 357042f19ac..be95f8c1a0c 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeRemoval.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeRemoval.php @@ -50,15 +50,15 @@ public function theCommandRemoveNodeAggregateIsExecutedWithPayload(TableNode $pa ? DimensionSpacePoint::fromArray($commandArguments['coveredDimensionSpacePoint']) : $this->currentDimensionSpacePoint; - $command = new RemoveNodeAggregate( + $command = RemoveNodeAggregate::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), $coveredDimensionSpacePoint, NodeVariantSelectionStrategy::from($commandArguments['nodeVariantSelectionStrategy']), - isset($commandArguments['removalAttachmentPoint']) - ? NodeAggregateId::fromString($commandArguments['removalAttachmentPoint']) - : null ); + if (isset($commandArguments['removalAttachmentPoint'])) { + $command = $command->withRemovalAttachmentPoint(NodeAggregateId::fromString($commandArguments['removalAttachmentPoint'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeTypeChange.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeTypeChange.php index 95c05ddc8c1..b8599625fd5 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeTypeChange.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeTypeChange.php @@ -43,17 +43,15 @@ public function theCommandChangeNodeAggregateTypeIsExecutedWithPayload(TableNode $contentStreamId = isset($commandArguments['contentStreamId']) ? ContentStreamId::fromString($commandArguments['contentStreamId']) : $this->currentContentStreamId; - $tetheredDescendantNodeAggregateIds = isset($commandArguments['tetheredDescendantNodeAggregateIds']) - ? NodeAggregateIdsByNodePaths::fromArray($commandArguments['tetheredDescendantNodeAggregateIds']) - : null; - - $command = new ChangeNodeAggregateType( + $command = ChangeNodeAggregateType::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), NodeTypeName::fromString($commandArguments['newNodeTypeName']), NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy::from($commandArguments['strategy']), - $tetheredDescendantNodeAggregateIds ); + if (isset($commandArguments['tetheredDescendantNodeAggregateIds'])) { + $command = $command->withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths::fromArray($commandArguments['tetheredDescendantNodeAggregateIds'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeVariation.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeVariation.php index 9676fa2b739..bc453cf6054 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeVariation.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/NodeVariation.php @@ -46,7 +46,7 @@ public function theCommandCreateNodeVariantIsExecutedWithPayload(TableNode $payl ? ContentStreamId::fromString($commandArguments['contentStreamId']) : $this->currentContentStreamId; - $command = new CreateNodeVariant( + $command = CreateNodeVariant::create( $contentStreamId, NodeAggregateId::fromString($commandArguments['nodeAggregateId']), OriginDimensionSpacePoint::fromArray($commandArguments['sourceOrigin']), diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceCreation.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceCreation.php index 7769cff28e3..e28b6d7ad9e 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceCreation.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceCreation.php @@ -47,7 +47,7 @@ public function theCommandCreateRootWorkspaceIsExecutedWithPayload(TableNode $pa { $commandArguments = $this->readPayloadTable($payloadTable); - $command = new CreateRootWorkspace( + $command = CreateRootWorkspace::create( WorkspaceName::fromString($commandArguments['workspaceName']), new WorkspaceTitle($commandArguments['workspaceTitle'] ?? ucfirst($commandArguments['workspaceName'])), new WorkspaceDescription($commandArguments['workspaceDescription'] ?? 'The workspace "' . $commandArguments['workspaceName'] . '"'), @@ -78,7 +78,7 @@ public function theCommandCreateWorkspaceIsExecutedWithPayload(TableNode $payloa { $commandArguments = $this->readPayloadTable($payloadTable); - $command = new CreateWorkspace( + $command = CreateWorkspace::create( WorkspaceName::fromString($commandArguments['workspaceName']), WorkspaceName::fromString($commandArguments['baseWorkspaceName']), new WorkspaceTitle($commandArguments['workspaceTitle'] ?? ucfirst($commandArguments['workspaceName'])), @@ -99,15 +99,12 @@ public function theCommandCreateWorkspaceIsExecutedWithPayload(TableNode $payloa public function theCommandRebaseWorkspaceIsExecutedWithPayload(TableNode $payloadTable) { $commandArguments = $this->readPayloadTable($payloadTable); - - $rebasedContentStreamId = isset($commandArguments['rebasedContentStreamId']) - ? ContentStreamId::fromString($commandArguments['rebasedContentStreamId']) - : ContentStreamId::create(); - - $command = RebaseWorkspace::createFullyDeterministic( + $command = RebaseWorkspace::create( WorkspaceName::fromString($commandArguments['workspaceName']), - $rebasedContentStreamId, ); + if (isset($commandArguments['rebasedContentStreamId'])) { + $command = $command->withRebasedContentStreamId(ContentStreamId::fromString($commandArguments['rebasedContentStreamId'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceDiscarding.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceDiscarding.php index 7ebefa8eec2..16334fe990b 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceDiscarding.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspaceDiscarding.php @@ -39,14 +39,12 @@ abstract protected function readPayloadTable(TableNode $payloadTable): array; public function theCommandDiscardWorkspaceIsExecuted(TableNode $payloadTable): void { $commandArguments = $this->readPayloadTable($payloadTable); - $newContentStreamId = isset($commandArguments['newContentStreamId']) - ? ContentStreamId::fromString($commandArguments['newContentStreamId']) - : ContentStreamId::create(); - - $command = DiscardWorkspace::createFullyDeterministic( + $command = DiscardWorkspace::create( WorkspaceName::fromString($commandArguments['workspaceName']), - $newContentStreamId ); + if (isset($commandArguments['newContentStreamId'])) { + $command = $command->withNewContentStreamId(ContentStreamId::fromString($commandArguments['newContentStreamId'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } @@ -61,15 +59,13 @@ public function theCommandDiscardIndividualNodesFromWorkspaceIsExecuted(TableNod { $commandArguments = $this->readPayloadTable($payloadTable); $nodesToDiscard = NodeIdsToPublishOrDiscard::fromArray($commandArguments['nodesToDiscard']); - $newContentStreamId = isset($commandArguments['newContentStreamId']) - ? ContentStreamId::fromString($commandArguments['newContentStreamId']) - : ContentStreamId::create(); - - $command = DiscardIndividualNodesFromWorkspace::createFullyDeterministic( + $command = DiscardIndividualNodesFromWorkspace::create( WorkspaceName::fromString($commandArguments['workspaceName']), $nodesToDiscard, - $newContentStreamId ); + if (isset($commandArguments['newContentStreamId'])) { + $command = $command->withNewContentStreamId(ContentStreamId::fromString($commandArguments['newContentStreamId'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspacePublishing.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspacePublishing.php index a0541729823..4d23e13bbcd 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspacePublishing.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Features/WorkspacePublishing.php @@ -41,20 +41,16 @@ public function theCommandPublishIndividualNodesFromWorkspaceIsExecuted(TableNod $commandArguments = $this->readPayloadTable($payloadTable); $nodesToPublish = NodeIdsToPublishOrDiscard::fromArray($commandArguments['nodesToPublish']); - $contentStreamIdForMatchingPart = isset($commandArguments['contentStreamIdForMatchingPart']) - ? ContentStreamId::fromString($commandArguments['contentStreamIdForMatchingPart']) - : ContentStreamId::create(); - - $contentStreamIdForRemainingPart = isset($commandArguments['contentStreamIdForRemainingPart']) - ? ContentStreamId::fromString($commandArguments['contentStreamIdForRemainingPart']) - : ContentStreamId::create(); - - $command = PublishIndividualNodesFromWorkspace::createFullyDeterministic( + $command = PublishIndividualNodesFromWorkspace::create( WorkspaceName::fromString($commandArguments['workspaceName']), $nodesToPublish, - $contentStreamIdForMatchingPart, - $contentStreamIdForRemainingPart ); + if (isset($commandArguments['contentStreamIdForMatchingPart'])) { + $command = $command->withContentStreamIdForMatchingPart(ContentStreamId::fromString($commandArguments['contentStreamIdForMatchingPart'])); + } + if (isset($commandArguments['contentStreamIdForRemainingPart'])) { + $command = $command->withContentStreamIdForRemainingPart(ContentStreamId::fromString($commandArguments['contentStreamIdForRemainingPart'])); + } $this->lastCommandOrEventResult = $this->currentContentRepository->handle($command); } @@ -68,7 +64,7 @@ public function theCommandPublishWorkspaceIsExecuted(TableNode $payloadTable): v { $commandArguments = $this->readPayloadTable($payloadTable); - $command = new PublishWorkspace( + $command = PublishWorkspace::create( WorkspaceName::fromString($commandArguments['workspaceName']), ); diff --git a/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php b/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php index 3a230621e46..62005598387 100644 --- a/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php +++ b/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php @@ -63,7 +63,7 @@ public function refreshRootNodeDimensionsCommand(string $contentRepository = 'de $rootNodeAggregate->nodeTypeName->value ]); $contentRepositoryInstance->handle( - new UpdateRootNodeAggregateDimensions( + UpdateRootNodeAggregateDimensions::create( $workspaceInstance->currentContentStreamId, $rootNodeAggregate->nodeAggregateId ) @@ -89,7 +89,7 @@ public function moveDimensionSpacePointCommand(string $source, string $target, s $this->outputLine('Resolved content stream %s', [$workspaceInstance->currentContentStreamId->value]); $contentRepositoryInstance->handle( - new MoveDimensionSpacePoint( + MoveDimensionSpacePoint::create( $workspaceInstance->currentContentStreamId, $sourceDimensionSpacePoint, $targetDimensionSpacePoint @@ -156,7 +156,7 @@ private function createVariantRecursivelyInternal(int $level, NodeAggregateId $p } try { // Tethered nodes' variants are automatically created when the parent is translated. - $contentRepository->handle(new CreateNodeVariant( + $contentRepository->handle(CreateNodeVariant::create( $contentStreamId, $childNode->nodeAggregateId, $childNode->originDimensionSpacePoint, diff --git a/Neos.Neos/Classes/Command/WorkspaceCommandController.php b/Neos.Neos/Classes/Command/WorkspaceCommandController.php index f9d433a6882..d4756a51bd0 100644 --- a/Neos.Neos/Classes/Command/WorkspaceCommandController.php +++ b/Neos.Neos/Classes/Command/WorkspaceCommandController.php @@ -64,7 +64,7 @@ public function publishCommand(string $workspace, string $contentRepositoryIdent $contentRepositoryId = ContentRepositoryId::fromString($contentRepositoryIdentifier); $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $contentRepository->handle(new PublishWorkspace( + $contentRepository->handle(PublishWorkspace::create( WorkspaceName::fromString($workspace), ))->block(); @@ -112,7 +112,7 @@ public function createRootCommand(string $name, string $contentRepositoryIdentif $contentRepositoryId = ContentRepositoryId::fromString($contentRepositoryIdentifier); $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $contentRepository->handle(new CreateRootWorkspace( + $contentRepository->handle(CreateRootWorkspace::create( WorkspaceName::fromString($name), WorkspaceTitle::fromString($name), WorkspaceDescription::fromString($name), @@ -156,7 +156,7 @@ public function createCommand( } try { - $contentRepository->handle(new CreateWorkspace( + $contentRepository->handle(CreateWorkspace::create( WorkspaceName::fromString($workspace), WorkspaceName::fromString($baseWorkspace), WorkspaceTitle::fromString($title ?: $workspace), diff --git a/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php b/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php index c6cb292fc97..5cc1a00fb17 100755 --- a/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php +++ b/Neos.Neos/Classes/Controller/Module/Administration/SitesController.php @@ -214,7 +214,7 @@ public function updateSiteAction(Site $site, $newSiteNodeName) ); foreach ($siteNodeAggregates as $siteNodeAggregate) { - $contentRepository->handle(new ChangeNodeAggregateName( + $contentRepository->handle(ChangeNodeAggregateName::create( $workspace->currentContentStreamId, $siteNodeAggregate->nodeAggregateId, NodeName::fromString($newSiteNodeName), diff --git a/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php b/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php index f31234019a7..bf782bfc86f 100644 --- a/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php +++ b/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php @@ -242,7 +242,7 @@ public function createAction( try { $contentRepository->handle( - new CreateWorkspace( + CreateWorkspace::create( $workspaceName, $baseWorkspace, $title, @@ -325,7 +325,7 @@ public function updateAction(WorkspaceName $workspaceName, WorkspaceTitle $title if (!$workspace->workspaceTitle?->equals($title) || !$workspace->workspaceDescription->equals($description)) { $contentRepository->handle( - new RenameWorkspace( + RenameWorkspace::create( $workspaceName, $title, $description @@ -335,7 +335,7 @@ public function updateAction(WorkspaceName $workspaceName, WorkspaceTitle $title if ($workspace->workspaceOwner !== $workspaceOwner) { $contentRepository->handle( - new ChangeWorkspaceOwner( + ChangeWorkspaceOwner::create( $workspaceName, $workspaceOwner ?: null, ) @@ -435,7 +435,7 @@ public function deleteAction(WorkspaceName $workspaceName) } $contentRepository->handle( - new DeleteWorkspace( + DeleteWorkspace::create( $workspaceName, ) )->block(); @@ -673,7 +673,7 @@ public function publishWorkspaceAction(WorkspaceName $workspace): void ->contentRepositoryId; $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); $contentRepository->handle( - new PublishWorkspace( + PublishWorkspace::create( $workspace ) )->block(); diff --git a/Neos.Neos/Classes/Controller/Service/NodesController.php b/Neos.Neos/Classes/Controller/Service/NodesController.php index 6505e7ea22a..f9bfdf3f638 100644 --- a/Neos.Neos/Classes/Controller/Service/NodesController.php +++ b/Neos.Neos/Classes/Controller/Service/NodesController.php @@ -426,7 +426,7 @@ protected function adoptNodeAndParents( . ' not found. This should never happen.', 1660905374); } $contentRepository->handle( - new CreateNodeVariant( + CreateNodeVariant::create( $contentStreamId, $identifier, $sourceNode->originDimensionSpacePoint, @@ -468,7 +468,7 @@ private function createNodeVariantsForChildNodes( // Tethered nodes' variants are automatically created when the parent is translated. // TODO: DOES THIS MAKE SENSE? $contentRepository->handle( - new CreateNodeVariant( + CreateNodeVariant::create( $contentStreamId, $childNode->nodeAggregateId, $childNode->originDimensionSpacePoint, diff --git a/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php b/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php index 36b2f57dfa9..5e9ce9ce471 100644 --- a/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php +++ b/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php @@ -79,7 +79,7 @@ public function removeSiteNode(SiteNodeName $siteNodeName): void foreach ($siteNodeAggregates as $siteNodeAggregate) { assert($siteNodeAggregate instanceof NodeAggregate); - $this->contentRepository->handle(new RemoveNodeAggregate( + $this->contentRepository->handle(RemoveNodeAggregate::create( $contentStreamId, $siteNodeAggregate->nodeAggregateId, $arbitraryDimensionSpacePoint, @@ -125,7 +125,7 @@ public function createSiteNodeIfNotExists(Site $site, string $nodeTypeName): voi $arbitraryRootDimensionSpacePoint = array_shift($rootDimensionSpacePoints); $siteNodeAggregateId = NodeAggregateId::create(); - $this->contentRepository->handle(new CreateNodeAggregateWithNode( + $this->contentRepository->handle(CreateNodeAggregateWithNode::create( $liveContentStreamId, $siteNodeAggregateId, NodeTypeName::fromString($nodeTypeName), @@ -140,7 +140,7 @@ public function createSiteNodeIfNotExists(Site $site, string $nodeTypeName): voi // Handle remaining root dimension space points by creating peer variants foreach ($rootDimensionSpacePoints as $rootDimensionSpacePoint) { - $this->contentRepository->handle(new CreateNodeVariant( + $this->contentRepository->handle(CreateNodeVariant::create( $liveContentStreamId, $siteNodeAggregateId, OriginDimensionSpacePoint::fromDimensionSpacePoint($arbitraryRootDimensionSpacePoint), diff --git a/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php b/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php index af42c9626b2..16054d16bae 100644 --- a/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php +++ b/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php @@ -126,7 +126,7 @@ public function relayEditorAuthentication(Authentication\TokenInterface $token): } $contentRepository->handle( - new CreateWorkspace( + CreateWorkspace::create( $workspaceName->toContentRepositoryWorkspaceName(), $baseWorkspace->workspaceName, new WorkspaceTitle((string) $user->getName()),