Skip to content

Commit

Permalink
TASK: Remove references to CommandResult in return types
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 17, 2024
1 parent 2914f11 commit 9eebb1e
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private function handlePublishWorkspace(
private function publishContentStream(
ContentStreamId $contentStreamId,
ContentStreamId $baseContentStreamId,
): ?CommandResult {
): void {
$baseWorkspaceContentStreamName = ContentStreamEventStreamName::fromContentStreamId(
$baseContentStreamId
);
Expand Down Expand Up @@ -322,10 +322,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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,8 +19,6 @@
*/
class ContentStreamPruner implements ContentRepositoryServiceInterface
{
private ?CommandResult $lastCommandResult;

public function __construct(
private readonly ContentRepository $contentRepository,
private readonly EventStoreInterface $eventStore,
Expand Down Expand Up @@ -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)
);
}
Expand Down Expand Up @@ -93,9 +90,4 @@ public function pruneAll(): void
$this->eventStore->deleteStream($streamName);
}
}

public function getLastCommandResult(): ?CommandResult
{
return $this->lastCommandResult;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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->nodeAggregateId,
Expand All @@ -81,8 +80,6 @@ public function execute(
)
);
}

return null;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -128,7 +127,7 @@ public function execute(
$newValueWithReplacedCurrentValue
);

return $this->contentRepository->handle(
$this->contentRepository->handle(
SetSerializedNodeProperties::create(
$workspaceNameForWriting,
$node->nodeAggregateId,
Expand All @@ -143,8 +142,6 @@ public function execute(
)
);
}

return null;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -27,5 +25,5 @@ interface GlobalTransformationInterface
{
public function execute(
WorkspaceName $workspaceNameForWriting,
): CommandResult;
): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,5 +29,5 @@ public function execute(
NodeAggregate $nodeAggregate,
WorkspaceName $workspaceNameForWriting,
ContentStreamId $contentStreamForWriting
): CommandResult;
): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,5 +31,5 @@ public function execute(
DimensionSpacePointSet $coveredDimensionSpacePoints,
WorkspaceName $workspaceNameForWriting,
ContentStreamId $contentStreamForWriting
): ?CommandResult;
): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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->nodeAggregateId,
$coveredDimensionSpacePoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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->nodeAggregateId,
Expand All @@ -66,8 +65,6 @@ public function execute(
)
);
}

return null;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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->nodeAggregateId,
Expand All @@ -77,8 +76,6 @@ public function execute(
)
);
}

return null;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -66,7 +65,7 @@ public function execute(
);
}
$newValue = strip_tags($propertyValue);
return $this->contentRepository->handle(
$this->contentRepository->handle(
SetSerializedNodeProperties::create(
$workspaceNameForWriting,
$node->nodeAggregateId,
Expand All @@ -81,8 +80,6 @@ public function execute(
)
);
}

return null;
}
};
}
Expand Down

0 comments on commit 9eebb1e

Please sign in to comment.