From 55e3fdfc334df7ae7cc1eb1206c5741641f563e3 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 17 May 2024 15:38:22 +0200 Subject: [PATCH 1/5] TASK: Remove references to `CommandResult` in return types --- .../Classes/CommandHandlingDependencies.php | 5 ++--- .../Classes/Feature/WorkspaceCommandHandler.php | 6 +++--- .../Classes/Service/ContentStreamPruner.php | 10 +--------- .../AddDimensionShineThroughTransformationFactory.php | 5 ++--- .../AddNewPropertyTransformationFactory.php | 9 +++------ .../ChangeNodeTypeTransformationFactory.php | 5 ++--- .../ChangePropertyValueTransformationFactory.php | 7 ++----- .../Transformation/GlobalTransformationInterface.php | 4 +--- .../MoveDimensionSpacePointTransformationFactory.php | 5 ++--- .../NodeAggregateBasedTransformationInterface.php | 3 +-- .../NodeBasedTransformationInterface.php | 3 +-- .../Transformation/RemoveNodeTransformationFactory.php | 7 +++---- .../RemovePropertyTransformationFactory.php | 7 ++----- .../RenameNodeAggregateTransformationFactory.php | 5 ++--- .../RenamePropertyTransformationFactory.php | 7 ++----- .../StripTagsOnPropertyTransformationFactory.php | 7 ++----- ...ootNodeAggregateDimensionsTransformationFactory.php | 5 ++--- 17 files changed, 33 insertions(+), 67 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php index c0b5270cc37..1f9e290c08d 100644 --- a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php +++ b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php @@ -15,7 +15,6 @@ namespace Neos\ContentRepository\Core; use Neos\ContentRepository\Core\CommandHandler\CommandInterface; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphInterface; use Neos\ContentRepository\Core\Projection\ContentStream\ContentStreamFinder; use Neos\ContentRepository\Core\Projection\Workspace\WorkspaceFinder; @@ -41,9 +40,9 @@ public function __construct(private readonly ContentRepository $contentRepositor { } - public function handle(CommandInterface $command): CommandResult + public function handle(CommandInterface $command): void { - return $this->contentRepository->handle($command); + $this->contentRepository->handle($command); } public function getWorkspaceFinder(): WorkspaceFinder diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 3789512c04d..b5276bb2f67 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -279,7 +279,7 @@ private function publishContentStream( ContentStreamId $contentStreamId, WorkspaceName $baseWorkspaceName, ContentStreamId $baseContentStreamId, - ): ?CommandResult { + ): void { $baseWorkspaceContentStreamName = ContentStreamEventStreamName::fromContentStreamId( $baseContentStreamId ); @@ -324,10 +324,10 @@ private function publishContentStream( } if (count($events) === 0) { - return null; + return; } try { - return $this->eventPersister->publishEvents( + $this->eventPersister->publishEvents( new EventsToPublish( $baseWorkspaceContentStreamName->getEventStreamName(), Events::fromArray($events), diff --git a/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php b/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php index eb5f5540917..ac6c6653c93 100644 --- a/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php +++ b/Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php @@ -4,7 +4,6 @@ namespace Neos\ContentRepository\Core\Service; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceInterface; use Neos\ContentRepository\Core\Feature\ContentStreamEventStreamName; @@ -20,8 +19,6 @@ */ class ContentStreamPruner implements ContentRepositoryServiceInterface { - private ?CommandResult $lastCommandResult; - public function __construct( private readonly ContentRepository $contentRepository, private readonly EventStoreInterface $eventStore, @@ -51,7 +48,7 @@ public function prune(bool $removeTemporary = false): iterable ); foreach ($unusedContentStreams as $contentStream) { - $this->lastCommandResult = $this->contentRepository->handle( + $this->contentRepository->handle( RemoveContentStream::create($contentStream) ); } @@ -93,9 +90,4 @@ public function pruneAll(): void $this->eventStore->deleteStream($streamName); } } - - public function getLastCommandResult(): ?CommandResult - { - return $this->lastCommandResult; - } } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php index 824dcae90a4..f8decab4901 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/AddDimensionShineThroughTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Feature\DimensionSpaceAdjustment\Command\AddDimensionShineThrough; @@ -50,8 +49,8 @@ public function __construct( public function execute( WorkspaceName $workspaceNameForWriting, - ): CommandResult { - return $this->contentRepository->handle( + ): void { + $this->contentRepository->handle( AddDimensionShineThrough::create( $workspaceNameForWriting, $this->from, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php index 778d3cd8d14..b6ad21e946a 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/AddNewPropertyTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetSerializedNodeProperties; @@ -59,14 +58,14 @@ public function execute( DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): ?CommandResult { + ): void { if ($this->serializedValue === null) { // we don't need to unset a non-existing property - return null; + return; } if (!$node->hasProperty($this->newPropertyName)) { - return $this->contentRepository->handle( + $this->contentRepository->handle( SetSerializedNodeProperties::create( $workspaceNameForWriting, $node->aggregateId, @@ -81,8 +80,6 @@ public function execute( ) ); } - - return null; } }; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php index 2c584214551..42ec7df2b4c 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/ChangeNodeTypeTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Feature\NodeTypeChange\Command\ChangeNodeAggregateType; use Neos\ContentRepository\Core\Feature\NodeTypeChange\Dto\NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy; @@ -65,8 +64,8 @@ public function execute( NodeAggregate $nodeAggregate, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): CommandResult { - return $this->contentRepository->handle(ChangeNodeAggregateType::create( + ): void { + $this->contentRepository->handle(ChangeNodeAggregateType::create( $workspaceNameForWriting, $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 41712b0325c..c0b51852b6b 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/ChangePropertyValueTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/ChangePropertyValueTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetSerializedNodeProperties; @@ -106,7 +105,7 @@ public function execute( DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): ?CommandResult { + ): void { $currentProperty = $node->properties->serialized()->getProperty($this->propertyName); if ($currentProperty !== null) { $value = $currentProperty->value; @@ -128,7 +127,7 @@ public function execute( $newValueWithReplacedCurrentValue ); - return $this->contentRepository->handle( + $this->contentRepository->handle( SetSerializedNodeProperties::create( $workspaceNameForWriting, $node->aggregateId, @@ -143,8 +142,6 @@ public function execute( ) ); } - - return null; } }; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/GlobalTransformationInterface.php b/Neos.ContentRepository.NodeMigration/src/Transformation/GlobalTransformationInterface.php index a8017546f84..7fed0930401 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/GlobalTransformationInterface.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/GlobalTransformationInterface.php @@ -14,8 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; -use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -27,5 +25,5 @@ interface GlobalTransformationInterface { public function execute( WorkspaceName $workspaceNameForWriting, - ): CommandResult; + ): void; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php index eeda40a3ea5..0b7cc1b7679 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/MoveDimensionSpacePointTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Feature\DimensionSpaceAdjustment\Command\MoveDimensionSpacePoint; @@ -48,8 +47,8 @@ public function __construct( public function execute( WorkspaceName $workspaceNameForWriting, - ): CommandResult { - return $this->contentRepository->handle( + ): void { + $this->contentRepository->handle( MoveDimensionSpacePoint::create( $workspaceNameForWriting, $this->from, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/NodeAggregateBasedTransformationInterface.php b/Neos.ContentRepository.NodeMigration/src/Transformation/NodeAggregateBasedTransformationInterface.php index e5421f8114a..8b2ebd2787c 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/NodeAggregateBasedTransformationInterface.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/NodeAggregateBasedTransformationInterface.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; @@ -30,5 +29,5 @@ public function execute( NodeAggregate $nodeAggregate, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): CommandResult; + ): void; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/NodeBasedTransformationInterface.php b/Neos.ContentRepository.NodeMigration/src/Transformation/NodeBasedTransformationInterface.php index 88a1573f674..1b2ab86ae4f 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/NodeBasedTransformationInterface.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/NodeBasedTransformationInterface.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; @@ -32,5 +31,5 @@ public function execute( DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): ?CommandResult; + ): void; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php index 53a2276fa3f..fbd0a2b46fa 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RemoveNodeTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; @@ -66,7 +65,7 @@ public function execute( DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): ?CommandResult { + ): void { if ($this->strategy === null) { $this->strategy = NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS; } @@ -84,10 +83,10 @@ public function execute( if (!$coveredDimensionSpacePoints->contains($coveredDimensionSpacePoint)) { // we are currently in a Node which has other covered dimension space points than the target ones, // so we do not need to do anything. - return null; + return; } - return $this->contentRepository->handle(RemoveNodeAggregate::create( + $this->contentRepository->handle(RemoveNodeAggregate::create( $workspaceNameForWriting, $node->aggregateId, $coveredDimensionSpacePoint, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php index 46d7e3255ca..c0990547e2d 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RemovePropertyTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetSerializedNodeProperties; @@ -54,9 +53,9 @@ public function execute( DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): ?CommandResult { + ): void { if ($node->hasProperty($this->propertyName)) { - return $this->contentRepository->handle( + $this->contentRepository->handle( SetSerializedNodeProperties::create( $workspaceNameForWriting, $node->aggregateId, @@ -66,8 +65,6 @@ public function execute( ) ); } - - return null; } }; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php index 207a34b3869..3e05d002d1b 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RenameNodeAggregateTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Feature\NodeRenaming\Command\ChangeNodeAggregateName; use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate; @@ -50,8 +49,8 @@ public function execute( NodeAggregate $nodeAggregate, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): CommandResult { - return $this->contentRepository->handle(ChangeNodeAggregateName::create( + ): void { + $this->contentRepository->handle(ChangeNodeAggregateName::create( $workspaceNameForWriting, $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 0d1cc13ed67..ff70a13bd7f 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/RenamePropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/RenamePropertyTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetSerializedNodeProperties; @@ -61,11 +60,11 @@ public function execute( DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): ?CommandResult + ): void { $serializedPropertyValue = $node->properties->serialized()->getProperty($this->from); if ($serializedPropertyValue !== null) { - return $this->contentRepository->handle( + $this->contentRepository->handle( SetSerializedNodeProperties::create( $workspaceNameForWriting, $node->aggregateId, @@ -77,8 +76,6 @@ public function execute( ) ); } - - return null; } }; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php index f071722b34f..9803c9509b2 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/StripTagsOnPropertyTransformationFactory.php @@ -14,7 +14,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetSerializedNodeProperties; @@ -55,7 +54,7 @@ public function execute( DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting - ): ?CommandResult { + ): void { $serializedPropertyValue = $node->properties->serialized()->getProperty($this->propertyName); if ($serializedPropertyValue !== null) { $propertyValue = $serializedPropertyValue->value; @@ -66,7 +65,7 @@ public function execute( ); } $newValue = strip_tags($propertyValue); - return $this->contentRepository->handle( + $this->contentRepository->handle( SetSerializedNodeProperties::create( $workspaceNameForWriting, $node->aggregateId, @@ -81,8 +80,6 @@ public function execute( ) ); } - - return null; } }; } diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/UpdateRootNodeAggregateDimensionsTransformationFactory.php b/Neos.ContentRepository.NodeMigration/src/Transformation/UpdateRootNodeAggregateDimensionsTransformationFactory.php index bf7a0e0f415..3b4b47867bb 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/UpdateRootNodeAggregateDimensionsTransformationFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/UpdateRootNodeAggregateDimensionsTransformationFactory.php @@ -4,7 +4,6 @@ namespace Neos\ContentRepository\NodeMigration\Transformation; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Feature\RootNodeCreation\Command\UpdateRootNodeAggregateDimensions; use Neos\ContentRepository\Core\NodeType\NodeTypeName; @@ -47,7 +46,7 @@ public function __construct( public function execute( WorkspaceName $workspaceNameForWriting, - ): CommandResult { + ): void { $rootNodeAggregate = $this->contentRepository->getContentGraph($workspaceNameForWriting)->findRootNodeAggregateByType($this->nodeTypeName); @@ -58,7 +57,7 @@ public function execute( ); } - return $this->contentRepository->handle( + $this->contentRepository->handle( UpdateRootNodeAggregateDimensions::create( $workspaceNameForWriting, $rootNodeAggregate->nodeAggregateId From e933f915579cc7573b1b291efa8b4ce0d21d4a4f Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:05:24 +0200 Subject: [PATCH 2/5] TASK: Remove `CommandResult` fully --- .../Classes/CommandHandler/CommandResult.php | 23 ------------------- .../Classes/ContentRepository.php | 6 ++--- .../Classes/EventStore/EventPersister.php | 8 ++----- .../Feature/WorkspaceCommandHandler.php | 1 - 4 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 Neos.ContentRepository.Core/Classes/CommandHandler/CommandResult.php diff --git a/Neos.ContentRepository.Core/Classes/CommandHandler/CommandResult.php b/Neos.ContentRepository.Core/Classes/CommandHandler/CommandResult.php deleted file mode 100644 index 626a2b56381..00000000000 --- a/Neos.ContentRepository.Core/Classes/CommandHandler/CommandResult.php +++ /dev/null @@ -1,23 +0,0 @@ -expectedVersion, ); - return $this->eventPersister->publishEvents($eventsToPublish); + $this->eventPersister->publishEvents($eventsToPublish); } diff --git a/Neos.ContentRepository.Core/Classes/EventStore/EventPersister.php b/Neos.ContentRepository.Core/Classes/EventStore/EventPersister.php index eef94b2a8f0..5823dee1ed5 100644 --- a/Neos.ContentRepository.Core/Classes/EventStore/EventPersister.php +++ b/Neos.ContentRepository.Core/Classes/EventStore/EventPersister.php @@ -4,11 +4,9 @@ namespace Neos\ContentRepository\Core\EventStore; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\CommandHandler\PendingProjections; use Neos\ContentRepository\Core\Projection\ProjectionCatchUpTriggerInterface; use Neos\ContentRepository\Core\Projection\Projections; -use Neos\ContentRepository\Core\Projection\WithMarkStaleInterface; use Neos\EventStore\EventStoreInterface; use Neos\EventStore\Exception\ConcurrencyException; use Neos\EventStore\Model\Events; @@ -31,13 +29,12 @@ public function __construct( /** * @param EventsToPublish $eventsToPublish - * @return CommandResult * @throws ConcurrencyException in case the expectedVersion does not match */ - public function publishEvents(EventsToPublish $eventsToPublish): CommandResult + public function publishEvents(EventsToPublish $eventsToPublish): void { if ($eventsToPublish->events->isEmpty()) { - return new CommandResult(); + return; } // the following logic could also be done in an AppEventStore::commit method (being called // directly from the individual Command Handlers). @@ -59,6 +56,5 @@ public function publishEvents(EventsToPublish $eventsToPublish): CommandResult ); $this->projectionCatchUpTrigger->triggerCatchUp($pendingProjections->projections); - return new CommandResult(); } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index b5276bb2f67..047e45ab510 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -16,7 +16,6 @@ use Neos\ContentRepository\Core\CommandHandler\CommandHandlerInterface; use Neos\ContentRepository\Core\CommandHandler\CommandInterface; -use Neos\ContentRepository\Core\CommandHandler\CommandResult; use Neos\ContentRepository\Core\CommandHandlingDependencies; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\EventStore\DecoratedEvent; From a38362180860cc0be8063e22aedd270bc12d13c7 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:07:25 +0200 Subject: [PATCH 3/5] TASK: Remove obsolete whitespace after `$contentRepository->handle` i guess $someone must have been using regex to remove the block calls or some other hacks:) (oops me^^) --- .../Classes/Controller/WorkspaceController.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php index c5710e14cfb..a94f71da178 100644 --- a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php +++ b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php @@ -511,8 +511,7 @@ public function publishNodeAction(string $nodeAddress, WorkspaceName $selectedWo ) ), ); - $contentRepository->handle($command) - ; + $contentRepository->handle($command); $this->addFlashMessage($this->translator->translateById( 'workspaces.selectedChangeHasBeenPublished', @@ -549,8 +548,7 @@ public function discardNodeAction(string $nodeAddress, WorkspaceName $selectedWo ) ), ); - $contentRepository->handle($command) - ; + $contentRepository->handle($command); $this->addFlashMessage($this->translator->translateById( 'workspaces.selectedChangeHasBeenDiscarded', @@ -593,8 +591,7 @@ public function publishOrDiscardNodesAction(array $nodes, string $action, string $selectedWorkspaceName, NodeIdsToPublishOrDiscard::create(...$nodesToPublishOrDiscard), ); - $contentRepository->handle($command) - ; + $contentRepository->handle($command); $this->addFlashMessage($this->translator->translateById( 'workspaces.selectedChangesHaveBeenPublished', [], @@ -609,8 +606,7 @@ public function publishOrDiscardNodesAction(array $nodes, string $action, string $selectedWorkspaceName, NodeIdsToPublishOrDiscard::create(...$nodesToPublishOrDiscard), ); - $contentRepository->handle($command) - ; + $contentRepository->handle($command); $this->addFlashMessage($this->translator->translateById( 'workspaces.selectedChangesHaveBeenDiscarded', [], From c056fe9a482c3e32d270356cef31d439576e45aa Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:41:18 +0200 Subject: [PATCH 4/5] TASK: Remove `*AndBlock` from namings --- .../src/NodeMigrationService.php | 12 ++++++------ .../src/Transformation/Transformations.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php index ba7279ce0c2..f6a4f2c8eca 100644 --- a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php +++ b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php @@ -94,8 +94,8 @@ public function executeMigration(ExecuteMigration $command): void } foreach ($command->migrationConfiguration->getMigration() as $migrationDescription) { - /** array $migrationDescription */ - $this->executeSubMigrationAndBlock( + /** @var array $migrationDescription */ + $this->executeSubMigration( $migrationDescription, $sourceWorkspace, $targetWorkspace @@ -121,7 +121,7 @@ public function executeMigration(ExecuteMigration $command): void * @param array $migrationDescription * @throws MigrationException */ - protected function executeSubMigrationAndBlock( + protected function executeSubMigration( array $migrationDescription, Workspace $workspaceForReading, Workspace $workspaceForWriting, @@ -153,7 +153,7 @@ protected function executeSubMigrationAndBlock( } if ($transformations->containsGlobal()) { - $transformations->executeGlobalAndBlock($workspaceForWriting->workspaceName); + $transformations->executeGlobal($workspaceForWriting->workspaceName); } elseif ($transformations->containsNodeAggregateBased()) { $contentGraph = $this->contentRepository->getContentGraph($workspaceForReading->workspaceName); foreach ($contentGraph->findUsedNodeTypeNames() as $nodeTypeName) { @@ -163,7 +163,7 @@ protected function executeSubMigrationAndBlock( ) as $nodeAggregate ) { if ($filters->matchesNodeAggregate($nodeAggregate)) { - $transformations->executeNodeAggregateBasedAndBlock($nodeAggregate, $workspaceForWriting->workspaceName, $workspaceForWriting->currentContentStreamId); + $transformations->executeNodeAggregateBased($nodeAggregate, $workspaceForWriting->workspaceName, $workspaceForWriting->currentContentStreamId); } } } @@ -189,7 +189,7 @@ protected function executeSubMigrationAndBlock( ); if ($filters->matchesNode($node)) { - $transformations->executeNodeBasedAndBlock( + $transformations->executeNodeBased( $node, $coveredDimensionSpacePoints, $workspaceForWriting->workspaceName, diff --git a/Neos.ContentRepository.NodeMigration/src/Transformation/Transformations.php b/Neos.ContentRepository.NodeMigration/src/Transformation/Transformations.php index cd95b41e224..531a1d4969a 100644 --- a/Neos.ContentRepository.NodeMigration/src/Transformation/Transformations.php +++ b/Neos.ContentRepository.NodeMigration/src/Transformation/Transformations.php @@ -90,7 +90,7 @@ public function containsMoreThanOneTransformationType(): bool return $nonEmptyTransformationTypes > 1; } - public function executeGlobalAndBlock( + public function executeGlobal( WorkspaceName $workspaceNameForWriting, ): void { foreach ($this->globalTransformations as $globalTransformation) { @@ -98,7 +98,7 @@ public function executeGlobalAndBlock( } } - public function executeNodeAggregateBasedAndBlock( + public function executeNodeAggregateBased( NodeAggregate $nodeAggregate, WorkspaceName $workspaceNameForWriting, ContentStreamId $contentStreamForWriting @@ -108,7 +108,7 @@ public function executeNodeAggregateBasedAndBlock( } } - public function executeNodeBasedAndBlock( + public function executeNodeBased( Node $node, DimensionSpacePointSet $coveredDimensionSpacePoints, WorkspaceName $workspaceNameForWriting, From 95e797e8b6550fea6276e15c7ae6aeab7a13bd3b Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:43:45 +0200 Subject: [PATCH 5/5] TASK: Remove outdated comments --- .../03-RebasingWithConflictingChanges.feature | 2 -- .../W7-WorkspacePublication/02-PublishWorkspace.feature | 2 -- .../04-AllFeaturePublication.feature | 2 -- .../W9-WorkspaceDiscarding/02-DiscardWorkspace.feature | 3 +-- .../Classes/Feature/WorkspaceCommandHandler.php | 2 -- .../src/NodeMigrationService.php | 1 - 6 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W6-WorkspaceRebasing/03-RebasingWithConflictingChanges.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W6-WorkspaceRebasing/03-RebasingWithConflictingChanges.feature index d12182497d7..cf7d6746261 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W6-WorkspaceRebasing/03-RebasingWithConflictingChanges.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W6-WorkspaceRebasing/03-RebasingWithConflictingChanges.feature @@ -37,8 +37,6 @@ Feature: Workspace rebasing - conflicting changes | nodeAggregateId | "nody-mc-nodeface" | | originDimensionSpacePoint | {} | | propertyValues | {"text": "Original"} | - # we need to ensure that the projections are up to date now; otherwise a content stream is forked with an out- - # of-date base version. This means the content stream can never be merged back, but must always be rebased. And the command CreateWorkspace is executed with payload: | Key | Value | | workspaceName | "user-test" | diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W7-WorkspacePublication/02-PublishWorkspace.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W7-WorkspacePublication/02-PublishWorkspace.feature index a8d0884563d..ad3ee6db36c 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W7-WorkspacePublication/02-PublishWorkspace.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W7-WorkspacePublication/02-PublishWorkspace.feature @@ -37,8 +37,6 @@ Feature: Workspace based content publishing | nodeAggregateId | "nody-mc-nodeface" | | originDimensionSpacePoint | {} | | propertyValues | {"text": "Original"} | - # we need to ensure that the projections are up to date now; otherwise a content stream is forked with an out- - # of-date base version. This means the content stream can never be merged back, but must always be rebased. And the command CreateWorkspace is executed with payload: | Key | Value | | workspaceName | "user-test" | diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature index cefedf691f0..f08d5bf47d4 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature @@ -129,8 +129,6 @@ Feature: Publishing hide/show scenario of nodes | nodeAggregateId | "sir-nodeward-nodington-iii" | | coveredDimensionSpacePoint | {} | | nodeVariantSelectionStrategy | "allVariants" | - # we need to ensure that the projections are up to date now; otherwise a content stream is forked with an out- - # of-date base version. This means the content stream can never be merged back, but must always be rebased. Given the command CreateWorkspace is executed with payload: | Key | Value | | workspaceName | "user-test" | diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W9-WorkspaceDiscarding/02-DiscardWorkspace.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W9-WorkspaceDiscarding/02-DiscardWorkspace.feature index 2174937dad7..e55d3c8326d 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W9-WorkspaceDiscarding/02-DiscardWorkspace.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W9-WorkspaceDiscarding/02-DiscardWorkspace.feature @@ -37,8 +37,7 @@ Feature: Workspace discarding - basic functionality | nodeAggregateId | "nody-mc-nodeface" | | originDimensionSpacePoint | {} | | propertyValues | {"text": "Original"} | - # we need to ensure that the projections are up to date now; otherwise a content stream is forked with an out- - # of-date base version. This means the content stream can never be merged back, but must always be rebased. + And the command CreateWorkspace is executed with payload: | Key | Value | | workspaceName | "user-test" | diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 047e45ab510..edc32a30bd8 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -793,8 +793,6 @@ private function handleDiscardWorkspace( ) ); - // It is safe to only return the last command result, - // as the commands which were rebased are already executed "synchronously" return new EventsToPublish( $streamName, $events, diff --git a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php index f6a4f2c8eca..081669e008c 100644 --- a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php +++ b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php @@ -94,7 +94,6 @@ public function executeMigration(ExecuteMigration $command): void } foreach ($command->migrationConfiguration->getMigration() as $migrationDescription) { - /** @var array $migrationDescription */ $this->executeSubMigration( $migrationDescription, $sourceWorkspace,