From 4087999b3b228a42d51048dc6c2c89ae4501977a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Sat, 19 Oct 2024 19:09:16 +0200 Subject: [PATCH] WIP: VirtualWorkspaceName --- .../src/ContentRepositoryReadModelAdapter.php | 3 +- .../src/Domain/Repository/ContentGraph.php | 5 +- .../src/Domain/Repository/ContentSubgraph.php | 5 +- .../src/Domain/Repository/NodeFactory.php | 11 +-- ...ContentHyperRepositoryReadModelAdapter.php | 3 +- .../Classes/CommandHandlingDependencies.php | 7 +- .../Classes/ContentRepository.php | 6 +- .../Classes/ContentRepositoryReadModel.php | 7 +- ...entRepositoryReadModelAdapterInterface.php | 3 +- .../Feature/Common/ConstraintChecks.php | 6 +- .../Feature/Common/EmbedsWorkspaceName.php | 3 +- .../RebasableToOtherWorkspaceInterface.php | 3 +- .../Command/AddDimensionShineThrough.php | 11 +-- .../Command/MoveDimensionSpacePoint.php | 11 +-- .../Event/DimensionShineThroughWasAdded.php | 9 ++- .../Event/DimensionSpacePointWasMoved.php | 7 +- ...gregateWithNodeAndSerializedProperties.php | 11 +-- .../Event/NodeAggregateWithNodeWasCreated.php | 7 +- .../Command/DisableNodeAggregate.php | 11 +-- .../Command/EnableNodeAggregate.php | 13 ++-- .../Event/NodeAggregateWasDisabled.php | 9 ++- .../Event/NodeAggregateWasEnabled.php | 9 ++- .../Command/CopyNodesRecursively.php | 13 ++-- .../Command/SetSerializedNodeProperties.php | 11 +-- .../Event/NodePropertiesWereSet.php | 9 ++- .../NodeMove/Command/MoveNodeAggregate.php | 11 +-- .../NodeMove/Event/NodeAggregateWasMoved.php | 9 ++- .../Command/SetSerializedNodeReferences.php | 11 +-- .../Event/NodeReferencesWereSet.php | 7 +- .../Command/RemoveNodeAggregate.php | 11 +-- .../Event/NodeAggregateWasRemoved.php | 7 +- .../Command/ChangeNodeAggregateName.php | 13 ++-- .../Event/NodeAggregateNameWasChanged.php | 7 +- .../Command/ChangeNodeAggregateType.php | 14 ++-- .../Event/NodeAggregateTypeWasChanged.php | 7 +- .../Command/CreateNodeVariant.php | 11 +-- .../NodeGeneralizationVariantWasCreated.php | 7 +- .../Event/NodePeerVariantWasCreated.php | 7 +- .../NodeSpecializationVariantWasCreated.php | 7 +- .../CreateRootNodeAggregateWithNode.php | 11 +-- .../UpdateRootNodeAggregateDimensions.php | 3 +- .../SubtreeTagging/Command/TagSubtree.php | 3 +- .../SubtreeTagging/Command/UntagSubtree.php | 3 +- .../SubtreeTagging/Event/SubtreeWasTagged.php | 7 +- .../Event/SubtreeWasUntagged.php | 7 +- .../Feature/WorkspaceCommandHandler.php | 78 ++++++++++--------- .../ContentGraph/ContentGraphInterface.php | 3 +- .../ContentGraph/ContentSubgraphInterface.php | 3 +- .../Classes/Projection/ContentGraph/Node.php | 7 +- .../Projection/ContentGraph/NodeAggregate.php | 7 +- .../Exception/WorkspaceDoesNotExist.php | 1 + .../Classes/SharedModel/Node/NodeAddress.php | 5 ++ .../Workspace/VirtualWorkspaceName.php | 53 +++++++++++++ .../SharedModel/Workspace/WorkspaceName.php | 6 ++ .../Adjustment/TetheredNodeAdjustments.php | 5 ++ .../CatchUpHook/AssetUsageCatchUpHook.php | 7 ++ .../Service/AssetUsageIndexingService.php | 5 ++ ...phProjectorCatchUpHookForCacheFlushing.php | 7 +- 58 files changed, 345 insertions(+), 198 deletions(-) create mode 100644 Neos.ContentRepository.Core/Classes/SharedModel/Workspace/VirtualWorkspaceName.php diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/ContentRepositoryReadModelAdapter.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/ContentRepositoryReadModelAdapter.php index 56ad85a9d63..013d25f3a3e 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/ContentRepositoryReadModelAdapter.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/ContentRepositoryReadModelAdapter.php @@ -25,6 +25,7 @@ use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreams; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamStatus; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspaces; @@ -46,7 +47,7 @@ public function __construct( ) { } - public function buildContentGraph(WorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraph + public function buildContentGraph(WorkspaceName|VirtualWorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraph { return new ContentGraph($this->dbal, $this->nodeFactory, $this->contentRepositoryId, $this->nodeTypeManager, $this->tableNames, $workspaceName, $contentStreamId); } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php index 68b0fd85fc0..8b2633891f2 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php @@ -37,6 +37,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -70,7 +71,7 @@ public function __construct( private readonly ContentRepositoryId $contentRepositoryId, private readonly NodeTypeManager $nodeTypeManager, private readonly ContentGraphTableNames $tableNames, - public readonly WorkspaceName $workspaceName, + public readonly WorkspaceName|VirtualWorkspaceName $workspaceName, public readonly ContentStreamId $contentStreamId ) { $this->nodeQueryBuilder = new NodeQueryBuilder($this->dbal, $this->tableNames); @@ -81,7 +82,7 @@ public function getContentRepositoryId(): ContentRepositoryId return $this->contentRepositoryId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php index 810a095069f..2851a047799 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php @@ -56,6 +56,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Node\PropertyName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -90,7 +91,7 @@ final class ContentSubgraph implements ContentSubgraphInterface public function __construct( private readonly ContentRepositoryId $contentRepositoryId, - private readonly WorkspaceName $workspaceName, + private readonly WorkspaceName|VirtualWorkspaceName $workspaceName, private readonly ContentStreamId $contentStreamId, private readonly DimensionSpacePoint $dimensionSpacePoint, private readonly VisibilityConstraints $visibilityConstraints, @@ -107,7 +108,7 @@ public function getContentRepositoryId(): ContentRepositoryId return $this->contentRepositoryId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/NodeFactory.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/NodeFactory.php index d16d803f788..af5c2871995 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/NodeFactory.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/NodeFactory.php @@ -41,6 +41,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Node\ReferenceName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Traversable; @@ -63,7 +64,7 @@ public function __construct( */ public function mapNodeRowToNode( array $nodeRow, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints ): Node { @@ -93,7 +94,7 @@ public function mapNodeRowToNode( */ public function mapNodeRowsToNodes( array $nodeRows, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints ): Nodes { @@ -120,7 +121,7 @@ public function createPropertyCollectionFromJsonString(string $jsonString): Prop */ public function mapReferenceRowsToReferences( array $nodeRows, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints ): References { @@ -150,7 +151,7 @@ public function mapReferenceRowsToReferences( */ public function mapNodeRowsToNodeAggregate( array $nodeRows, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, VisibilityConstraints $visibilityConstraints ): ?NodeAggregate { if (empty($nodeRows)) { @@ -231,7 +232,7 @@ public function mapNodeRowsToNodeAggregate( */ public function mapNodeRowsToNodeAggregates( array $nodeRows, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, VisibilityConstraints $visibilityConstraints ): NodeAggregates { if (empty($nodeRows)) { diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/ContentHyperRepositoryReadModelAdapter.php b/Neos.ContentGraph.PostgreSQLAdapter/src/ContentHyperRepositoryReadModelAdapter.php index 245ddd82d1f..9aa8853ba92 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/ContentHyperRepositoryReadModelAdapter.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/ContentHyperRepositoryReadModelAdapter.php @@ -15,6 +15,7 @@ use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStream; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreams; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspaces; @@ -34,7 +35,7 @@ public function __construct( ) { } - public function buildContentGraph(WorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraphInterface + public function buildContentGraph(WorkspaceName|VirtualWorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraphInterface { return new ContentHyperGraph($this->dbal, $this->nodeFactory, $this->contentRepositoryId, $this->nodeTypeManager, $this->tableNamePrefix, $workspaceName, $contentStreamId); } diff --git a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php index 1c778159fcd..b5d3294b102 100644 --- a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php +++ b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php @@ -21,6 +21,7 @@ use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamStatus; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\EventStore\Model\Event\Version; @@ -78,8 +79,12 @@ public function findWorkspaceByName(WorkspaceName $workspaceName): ?Workspace /** * @throws WorkspaceDoesNotExist if the workspace does not exist */ - public function getContentGraph(WorkspaceName $workspaceName): ContentGraphInterface + public function getContentGraph(WorkspaceName|VirtualWorkspaceName $workspaceName): ContentGraphInterface { + if ($workspaceName instanceof VirtualWorkspaceName) { + return $this->contentRepository->projectionState(ContentRepositoryReadModel::class)->getContentGraphByWorkspaceNameAndContentStreamId($workspaceName, $workspaceName->contentStreamId); + } + if (isset($this->overriddenContentGraphInstances[$workspaceName->value])) { return $this->overriddenContentGraphInstances[$workspaceName->value]; } diff --git a/Neos.ContentRepository.Core/Classes/ContentRepository.php b/Neos.ContentRepository.Core/Classes/ContentRepository.php index 2acb37f73e2..96743a094ad 100644 --- a/Neos.ContentRepository.Core/Classes/ContentRepository.php +++ b/Neos.ContentRepository.Core/Classes/ContentRepository.php @@ -40,6 +40,7 @@ use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist; use Neos\ContentRepository\Core\SharedModel\User\UserIdProviderInterface; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStream; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreams; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace; @@ -240,8 +241,11 @@ public function resetProjectionState(string $projectionClassName): void /** * @throws WorkspaceDoesNotExist if the workspace does not exist */ - public function getContentGraph(WorkspaceName $workspaceName): ContentGraphInterface + public function getContentGraph(WorkspaceName|VirtualWorkspaceName $workspaceName): ContentGraphInterface { + if ($workspaceName instanceof VirtualWorkspaceName) { + return $this->getContentRepositoryReadModel()->getContentGraphByWorkspaceNameAndContentStreamId($workspaceName, $workspaceName->contentStreamId); + } return $this->getContentRepositoryReadModel()->getContentGraphByWorkspaceName($workspaceName); } diff --git a/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModel.php b/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModel.php index 38733eaf7a7..df87d4f7716 100644 --- a/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModel.php +++ b/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModel.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStream; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreams; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspaces; @@ -66,7 +67,7 @@ public function findContentStreams(): ContentStreams * @throws WorkspaceDoesNotExist if the provided workspace does not resolve to an existing content stream * @see ContentRepository::getContentGraph() */ - public function getContentGraphByWorkspaceName(WorkspaceName $workspaceName): ContentGraphInterface + public function getContentGraphByWorkspaceName(WorkspaceName|VirtualWorkspaceName $workspaceName): ContentGraphInterface { $workspace = $this->findWorkspaceByName($workspaceName); if ($workspace === null) { @@ -78,11 +79,11 @@ public function getContentGraphByWorkspaceName(WorkspaceName $workspaceName): Co /** * For testing we allow getting an instance set by both parameters, effectively overriding the relationship at will * - * @param WorkspaceName $workspaceName + * @param WorkspaceName|VirtualWorkspaceName $workspaceName * @param ContentStreamId $contentStreamId * @internal Only for testing */ - public function getContentGraphByWorkspaceNameAndContentStreamId(WorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraphInterface + public function getContentGraphByWorkspaceNameAndContentStreamId(WorkspaceName|VirtualWorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraphInterface { return $this->adapter->buildContentGraph($workspaceName, $contentStreamId); } diff --git a/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModelAdapterInterface.php b/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModelAdapterInterface.php index 7d266fdec9d..dd0856c1e33 100644 --- a/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModelAdapterInterface.php +++ b/Neos.ContentRepository.Core/Classes/ContentRepositoryReadModelAdapterInterface.php @@ -19,6 +19,7 @@ use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStream; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreams; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspaces; @@ -30,7 +31,7 @@ */ interface ContentRepositoryReadModelAdapterInterface { - public function buildContentGraph(WorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraphInterface; + public function buildContentGraph(WorkspaceName|VirtualWorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraphInterface; public function findWorkspaceByName(WorkspaceName $workspaceName): ?Workspace; diff --git a/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php b/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php index 428ac575ee8..321362dee45 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php +++ b/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php @@ -61,6 +61,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\ReferenceName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamStatus; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\EventStore\Model\EventStream\ExpectedVersion; @@ -77,9 +78,12 @@ abstract protected function getAllowedDimensionSubspace(): DimensionSpacePointSe * @throws ContentStreamDoesNotExistYet */ protected function requireContentStream( - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, CommandHandlingDependencies $commandHandlingDependencies ): ContentStreamId { + if ($workspaceName instanceof VirtualWorkspaceName && $commandHandlingDependencies->contentStreamExists($workspaceName->contentStreamId)) { + return $workspaceName->contentStreamId; + } $contentStreamId = $commandHandlingDependencies->getContentGraph($workspaceName)->getContentStreamId(); if (!$commandHandlingDependencies->contentStreamExists($contentStreamId)) { throw new ContentStreamDoesNotExistYet( diff --git a/Neos.ContentRepository.Core/Classes/Feature/Common/EmbedsWorkspaceName.php b/Neos.ContentRepository.Core/Classes/Feature/Common/EmbedsWorkspaceName.php index a9b9f5f85ba..c4c71502287 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/Common/EmbedsWorkspaceName.php +++ b/Neos.ContentRepository.Core/Classes/Feature/Common/EmbedsWorkspaceName.php @@ -14,6 +14,7 @@ namespace Neos\ContentRepository\Core\Feature\Common; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -25,5 +26,5 @@ */ interface EmbedsWorkspaceName { - public function getWorkspaceName(): WorkspaceName; + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName; } diff --git a/Neos.ContentRepository.Core/Classes/Feature/Common/RebasableToOtherWorkspaceInterface.php b/Neos.ContentRepository.Core/Classes/Feature/Common/RebasableToOtherWorkspaceInterface.php index 4d2d5094818..28eb22363f3 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/Common/RebasableToOtherWorkspaceInterface.php +++ b/Neos.ContentRepository.Core/Classes/Feature/Common/RebasableToOtherWorkspaceInterface.php @@ -15,6 +15,7 @@ namespace Neos\ContentRepository\Core\Feature\Common; use Neos\ContentRepository\Core\CommandHandler\CommandInterface; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -28,7 +29,7 @@ interface RebasableToOtherWorkspaceInterface { public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): CommandInterface; /** diff --git a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php index 936505d278d..c608751b2ad 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php +++ b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/AddDimensionShineThrough.php @@ -18,6 +18,7 @@ use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -39,24 +40,24 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The name of the workspace to perform the operation in. + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The name of the workspace to perform the operation in. * @param DimensionSpacePoint $source source dimension space point * @param DimensionSpacePoint $target target dimension space point */ private function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public DimensionSpacePoint $source, public DimensionSpacePoint $target ) { } /** - * @param WorkspaceName $workspaceName The name of the workspace to perform the operation in + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The name of the workspace to perform the operation in * @param DimensionSpacePoint $source source dimension space point * @param DimensionSpacePoint $target target dimension space point */ public static function create( - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, DimensionSpacePoint $source, DimensionSpacePoint $target ): self { @@ -75,7 +76,7 @@ public static function fromArray(array $array): self ); } - public function createCopyForWorkspace(WorkspaceName $targetWorkspaceName): self + public function createCopyForWorkspace(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php index 498ba261e49..fff9da43622 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php +++ b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Command/MoveDimensionSpacePoint.php @@ -17,6 +17,7 @@ use Neos\ContentRepository\Core\CommandHandler\CommandInterface; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -34,24 +35,24 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The name of the workspace to perform the operation in. + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The name of the workspace to perform the operation in. * @param DimensionSpacePoint $source source dimension space point * @param DimensionSpacePoint $target target dimension space point */ private function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public DimensionSpacePoint $source, public DimensionSpacePoint $target, ) { } /** - * @param WorkspaceName $workspaceName The name of the workspace to perform the operation in + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The name of the workspace to perform the operation in * @param DimensionSpacePoint $source source dimension space point * @param DimensionSpacePoint $target target dimension space point */ public static function create( - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, DimensionSpacePoint $source, DimensionSpacePoint $target ): self { @@ -71,7 +72,7 @@ public static function fromArray(array $array): self } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionShineThroughWasAdded.php b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionShineThroughWasAdded.php index e6806c40b84..89eb4265ca6 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionShineThroughWasAdded.php +++ b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionShineThroughWasAdded.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName; use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -38,7 +39,7 @@ final readonly class DimensionShineThroughWasAdded implements EventInterface, PublishableToWorkspaceInterface, EmbedsContentStreamId, EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public DimensionSpacePoint $source, public DimensionSpacePoint $target @@ -50,12 +51,12 @@ public function getContentStreamId(): ContentStreamId return $this->contentStreamId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } - public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self + public function withWorkspaceNameAndContentStreamId(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self { return new self( $targetWorkspaceName, @@ -68,7 +69,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), DimensionSpacePoint::fromArray($values['source']), DimensionSpacePoint::fromArray($values['target']) diff --git a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionSpacePointWasMoved.php b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionSpacePointWasMoved.php index 2e9c014c672..df6980244ca 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionSpacePointWasMoved.php +++ b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/Event/DimensionSpacePointWasMoved.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName; use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -34,7 +35,7 @@ final readonly class DimensionSpacePointWasMoved implements EventInterface, PublishableToWorkspaceInterface, EmbedsContentStreamId, EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public DimensionSpacePoint $source, public DimensionSpacePoint $target @@ -46,7 +47,7 @@ public function getContentStreamId(): ContentStreamId return $this->contentStreamId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -64,7 +65,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), DimensionSpacePoint::fromArray($values['source']), DimensionSpacePoint::fromArray($values['target']) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php index f295cd6dabe..9b6f0454a3e 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Command/CreateNodeAggregateWithNodeAndSerializedProperties.php @@ -24,6 +24,7 @@ use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -39,7 +40,7 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the create operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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. @@ -50,7 +51,7 @@ * @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()}) */ private function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public NodeTypeName $nodeTypeName, public OriginDimensionSpacePoint $originDimensionSpacePoint, @@ -63,7 +64,7 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the create operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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. @@ -71,7 +72,7 @@ private function __construct( * @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 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(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateId $parentNodeAggregateId, NodeAggregateId $succeedingSiblingNodeAggregateId = null, SerializedPropertyValues $initialPropertyValues = null): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateId $parentNodeAggregateId, NodeAggregateId $succeedingSiblingNodeAggregateId = null, SerializedPropertyValues $initialPropertyValues = null): self { return new self($workspaceName, $nodeAggregateId, $nodeTypeName, $originDimensionSpacePoint, $parentNodeAggregateId, $initialPropertyValues ?? SerializedPropertyValues::createEmpty(), $succeedingSiblingNodeAggregateId, null, NodeAggregateIdsByNodePaths::createEmpty()); } @@ -162,7 +163,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Event/NodeAggregateWithNodeWasCreated.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Event/NodeAggregateWithNodeWasCreated.php index 9b1d63975b8..8da2388d4fb 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Event/NodeAggregateWithNodeWasCreated.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Event/NodeAggregateWithNodeWasCreated.php @@ -28,6 +28,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -43,7 +44,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public NodeTypeName $nodeTypeName, @@ -66,7 +67,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -95,7 +96,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), NodeTypeName::fromString($values['nodeTypeName']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php index 454b7c2ccb2..fbbb230a383 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/DisableNodeAggregate.php @@ -22,6 +22,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -36,13 +37,13 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the disable operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public DimensionSpacePoint $coveredDimensionSpacePoint, public NodeVariantSelectionStrategy $nodeVariantSelectionStrategy, @@ -50,12 +51,12 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the disable operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self { return new self($workspaceName, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy); } @@ -90,7 +91,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php index de0ad11d57d..d2acb11b606 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Command/EnableNodeAggregate.php @@ -22,6 +22,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -36,13 +37,13 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the enable operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public DimensionSpacePoint $coveredDimensionSpacePoint, public NodeVariantSelectionStrategy $nodeVariantSelectionStrategy, @@ -50,12 +51,12 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The content stream in which the enable operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName 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(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self { return new self($workspaceName, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy); } @@ -66,7 +67,7 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod public static function fromArray(array $array): self { return new self( - WorkspaceName::fromString($array['workspaceName']), + VirtualWorkspaceName::isVirtual($array['workspaceName']) ? VirtualWorkspaceName::fromString($array['workspaceName']) : WorkspaceName::fromString($array['workspaceName']), NodeAggregateId::fromString($array['nodeAggregateId']), DimensionSpacePoint::fromArray($array['coveredDimensionSpacePoint']), NodeVariantSelectionStrategy::from($array['nodeVariantSelectionStrategy']), @@ -90,7 +91,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasDisabled.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasDisabled.php index e65d6ce7055..0ceb918289b 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasDisabled.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasDisabled.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasTagged; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -39,7 +40,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, /** The dimension space points the node aggregate was disabled in */ @@ -57,12 +58,12 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } - public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self + public function withWorkspaceNameAndContentStreamId(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self { return new self( $targetWorkspaceName, @@ -75,7 +76,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): EventInterface { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), DimensionSpacePointSet::fromArray($values['affectedDimensionSpacePoints']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasEnabled.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasEnabled.php index f863fd97a8a..9df3efc56f1 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasEnabled.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDisabling/Event/NodeAggregateWasEnabled.php @@ -24,6 +24,7 @@ use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasUntagged; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -40,7 +41,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public DimensionSpacePointSet $affectedDimensionSpacePoints, @@ -57,12 +58,12 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } - public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self + public function withWorkspaceNameAndContentStreamId(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self { return new self( $targetWorkspaceName, @@ -75,7 +76,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): EventInterface { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), DimensionSpacePointSet::fromArray($values['affectedDimensionSpacePoints']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php index 52355fd5e4a..7b620b8a9cd 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Command/CopyNodesRecursively.php @@ -26,6 +26,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -44,7 +45,7 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The name of the workspace this command is to be handled in + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The name of the workspace 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 @@ -53,7 +54,7 @@ * @param NodeAggregateIdMapping $nodeAggregateIdMapping An assignment of "old" to "new" NodeAggregateIds ({@see NodeAggregateIdMapping}) */ private function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeSubtreeSnapshot $nodeTreeToInsert, public OriginDimensionSpacePoint $targetDimensionSpacePoint, public NodeAggregateId $targetParentNodeAggregateId, @@ -64,14 +65,14 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The name of the workspace this command is to be handled in + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The name of the workspace 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 NodeAggregateIdMapping $nodeAggregateIdMapping An assignment of "old" to "new" NodeAggregateIds ({@see NodeAggregateIdMapping}) */ - public static function create(WorkspaceName $workspaceName, NodeSubtreeSnapshot $nodeTreeToInsert, OriginDimensionSpacePoint $targetDimensionSpacePoint, NodeAggregateId $targetParentNodeAggregateId, ?NodeAggregateId $targetSucceedingSiblingNodeAggregateId, NodeAggregateIdMapping $nodeAggregateIdMapping): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeSubtreeSnapshot $nodeTreeToInsert, OriginDimensionSpacePoint $targetDimensionSpacePoint, NodeAggregateId $targetParentNodeAggregateId, ?NodeAggregateId $targetSucceedingSiblingNodeAggregateId, NodeAggregateIdMapping $nodeAggregateIdMapping): self { return new self($workspaceName, $nodeTreeToInsert, $targetDimensionSpacePoint, $targetParentNodeAggregateId, $targetSucceedingSiblingNodeAggregateId, null, $nodeAggregateIdMapping); } @@ -81,7 +82,7 @@ public static function create(WorkspaceName $workspaceName, NodeSubtreeSnapshot */ public static function createFromSubgraphAndStartNode( ContentSubgraphInterface $subgraph, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, Node $startNode, OriginDimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $targetParentNodeAggregateId, @@ -171,7 +172,7 @@ public function withTargetNodeName(NodeName $targetNodeName): self } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php index ca589337e85..bc68413ec5d 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetSerializedNodeProperties.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\PropertyNames; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -39,14 +40,14 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the set properties operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 * @param PropertyNames $propertiesToUnset Names of properties to unset */ private function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public OriginDimensionSpacePoint $originDimensionSpacePoint, public SerializedPropertyValues $propertyValues, @@ -55,14 +56,14 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the set properties operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 * @param PropertyNames $propertiesToUnset Names of properties to unset */ public static function create( - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, OriginDimensionSpacePoint $originDimensionSpacePoint, SerializedPropertyValues $propertyValues, @@ -109,7 +110,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Event/NodePropertiesWereSet.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Event/NodePropertiesWereSet.php index 69b3e4c2c96..09d85642285 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Event/NodePropertiesWereSet.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Event/NodePropertiesWereSet.php @@ -25,6 +25,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\PropertyNames; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -46,7 +47,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public OriginDimensionSpacePoint $originDimensionSpacePoint, @@ -67,7 +68,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -77,7 +78,7 @@ public function getOriginDimensionSpacePoint(): OriginDimensionSpacePoint return $this->originDimensionSpacePoint; } - public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self + public function withWorkspaceNameAndContentStreamId(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self { return new self( $targetWorkspaceName, @@ -106,7 +107,7 @@ public function mergeProperties(self $other): self public static function fromArray(array $values): EventInterface { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), OriginDimensionSpacePoint::fromArray($values['originDimensionSpacePoint']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php index 3a756163488..60c00b8b9da 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php @@ -22,6 +22,7 @@ use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -49,7 +50,7 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the move operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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}) @@ -58,7 +59,7 @@ * @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 WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public DimensionSpacePoint $dimensionSpacePoint, public NodeAggregateId $nodeAggregateId, public RelationDistributionStrategy $relationDistributionStrategy, @@ -69,7 +70,7 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the move operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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}) @@ -77,7 +78,7 @@ private function __construct( * @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(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, RelationDistributionStrategy $relationDistributionStrategy, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, RelationDistributionStrategy $relationDistributionStrategy, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self { return new self($workspaceName, $dimensionSpacePoint, $nodeAggregateId, $relationDistributionStrategy, $newParentNodeAggregateId, $newPrecedingSiblingNodeAggregateId, $newSucceedingSiblingNodeAggregateId); } @@ -119,7 +120,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Event/NodeAggregateWasMoved.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Event/NodeAggregateWasMoved.php index c9c50fa03f2..8daedf672eb 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Event/NodeAggregateWasMoved.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Event/NodeAggregateWasMoved.php @@ -14,6 +14,7 @@ use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -59,7 +60,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public ?NodeAggregateId $newParentNodeAggregateId, @@ -77,12 +78,12 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } - public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self + public function withWorkspaceNameAndContentStreamId(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self { return new self( $targetWorkspaceName, @@ -128,7 +129,7 @@ public static function fromArray(array $values): self } return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), $newParentNodeAggregateId, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php index 3f635af08e0..b4169f301ea 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Command/SetSerializedNodeReferences.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\ReferenceName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -39,14 +40,14 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the create operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $sourceNodeAggregateId, public OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint, public ReferenceName $referenceName, @@ -55,13 +56,13 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the create operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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(WorkspaceName $workspaceName, NodeAggregateId $sourceNodeAggregateId, OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint, ReferenceName $referenceName, SerializedNodeReferences $references): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $sourceNodeAggregateId, OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint, ReferenceName $referenceName, SerializedNodeReferences $references): self { return new self($workspaceName, $sourceNodeAggregateId, $sourceOriginDimensionSpacePoint, $referenceName, $references); } @@ -97,7 +98,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Event/NodeReferencesWereSet.php b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Event/NodeReferencesWereSet.php index 21440d1a659..663e2f6c959 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Event/NodeReferencesWereSet.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/Event/NodeReferencesWereSet.php @@ -14,6 +14,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\ReferenceName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -31,7 +32,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, /** @@ -56,7 +57,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -76,7 +77,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), array_key_exists('sourceNodeAggregateId', $values) ? NodeAggregateId::fromString($values['sourceNodeAggregateId']) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php index 085af255b8c..3f66638591e 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Command/RemoveNodeAggregate.php @@ -21,6 +21,7 @@ use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -33,14 +34,14 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the remove operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace in which the remove operation is to be performed * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to remove * @param DimensionSpacePoint $coveredDimensionSpacePoint One of the dimension space points covered by the node aggregate in which the user intends to remove it * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be removed * @param NodeAggregateId|null $removalAttachmentPoint Internal. It stores the document node id of the removed node, as that is what the UI needs later on for the change display. {@see self::withRemovalAttachmentPoint()} */ private function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public DimensionSpacePoint $coveredDimensionSpacePoint, public NodeVariantSelectionStrategy $nodeVariantSelectionStrategy, @@ -49,12 +50,12 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the remove operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace in which the remove operation is to be performed * @param NodeAggregateId $nodeAggregateId The identifier of the node aggregate to remove * @param DimensionSpacePoint $coveredDimensionSpacePoint One of the dimension space points covered by the node aggregate in which the user intends to remove it * @param NodeVariantSelectionStrategy $nodeVariantSelectionStrategy The strategy the user chose to determine which specialization variants will also be removed */ - public static function create(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, DimensionSpacePoint $coveredDimensionSpacePoint, NodeVariantSelectionStrategy $nodeVariantSelectionStrategy): self { return new self($workspaceName, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy, null); } @@ -109,7 +110,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Event/NodeAggregateWasRemoved.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Event/NodeAggregateWasRemoved.php index b3a82f88b2d..8d3cff5dbca 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Event/NodeAggregateWasRemoved.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/Event/NodeAggregateWasRemoved.php @@ -24,6 +24,7 @@ use Neos\ContentRepository\Core\Feature\NodeRemoval\Command\RemoveNodeAggregate; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -37,7 +38,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public OriginDimensionSpacePointSet $affectedOccupiedDimensionSpacePoints, @@ -57,7 +58,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -77,7 +78,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), OriginDimensionSpacePointSet::fromArray($values['affectedOccupiedDimensionSpacePoints']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php index 38d1f195ed6..890ca7ee734 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Command/ChangeNodeAggregateName.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -38,23 +39,23 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public NodeName $newNodeName, ) { } /** - * @param WorkspaceName $workspaceName The workspace in which the operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeName $newNodeName): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeName $newNodeName): self { return new self($workspaceName, $nodeAggregateId, $newNodeName); } @@ -65,7 +66,7 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod public static function fromArray(array $array): self { return new self( - WorkspaceName::fromString($array['workspaceName']), + VirtualWorkspaceName::isVirtual($array['workspaceName']) ? VirtualWorkspaceName::fromString($array['workspaceName']) : WorkspaceName::fromString($array['workspaceName']), NodeAggregateId::fromString($array['nodeAggregateId']), NodeName::fromString($array['newNodeName']), ); @@ -85,7 +86,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Event/NodeAggregateNameWasChanged.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Event/NodeAggregateNameWasChanged.php index 73956b43f54..43bee75f141 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Event/NodeAggregateNameWasChanged.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/Event/NodeAggregateNameWasChanged.php @@ -22,6 +22,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -35,7 +36,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public NodeName $newNodeName, @@ -52,7 +53,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -70,7 +71,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), NodeName::fromString($values['newNodeName']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php index e979e4d25c1..ed885eee77c 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Command/ChangeNodeAggregateType.php @@ -22,7 +22,7 @@ use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard; use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; -use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -35,14 +35,14 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public NodeTypeName $newNodeTypeName, public NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy $strategy, @@ -51,12 +51,12 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $newNodeTypeName, NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy $strategy): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $newNodeTypeName, NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy $strategy): self { return new self($workspaceName, $nodeAggregateId, $newNodeTypeName, $strategy, NodeAggregateIdsByNodePaths::createEmpty()); } @@ -67,7 +67,7 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod public static function fromArray(array $array): self { return new self( - WorkspaceName::fromString($array['workspaceName']), + VirtualWorkspaceName::isVirtual($array['workspaceName']) ? VirtualWorkspaceName::fromString($array['workspaceName']) : WorkspaceName::fromString($array['workspaceName']), NodeAggregateId::fromString($array['nodeAggregateId']), NodeTypeName::fromString($array['newNodeTypeName']), NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy::from($array['strategy']), @@ -108,7 +108,7 @@ public function withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePat } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Event/NodeAggregateTypeWasChanged.php b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Event/NodeAggregateTypeWasChanged.php index 0b09e68fc2d..7dd6348fd79 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Event/NodeAggregateTypeWasChanged.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/Event/NodeAggregateTypeWasChanged.php @@ -22,6 +22,7 @@ use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -35,7 +36,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public NodeTypeName $newNodeTypeName @@ -52,7 +53,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -70,7 +71,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), NodeTypeName::fromString($values['newNodeTypeName']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php index 001f9bd66e9..48194c01824 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Command/CreateNodeVariant.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -36,13 +37,13 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the create operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public OriginDimensionSpacePoint $sourceOrigin, public OriginDimensionSpacePoint $targetOrigin, @@ -50,12 +51,12 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the create operation is to be performed + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, OriginDimensionSpacePoint $sourceOrigin, OriginDimensionSpacePoint $targetOrigin): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, OriginDimensionSpacePoint $sourceOrigin, OriginDimensionSpacePoint $targetOrigin): self { return new self($workspaceName, $nodeAggregateId, $sourceOrigin, $targetOrigin); } @@ -88,7 +89,7 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeGeneralizationVariantWasCreated.php b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeGeneralizationVariantWasCreated.php index dbbea290d28..7104940512c 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeGeneralizationVariantWasCreated.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeGeneralizationVariantWasCreated.php @@ -24,6 +24,7 @@ use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -39,7 +40,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public OriginDimensionSpacePoint $sourceOrigin, @@ -58,7 +59,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -78,7 +79,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), OriginDimensionSpacePoint::fromArray($values['sourceOrigin']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodePeerVariantWasCreated.php b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodePeerVariantWasCreated.php index 10408317c5f..266d041b684 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodePeerVariantWasCreated.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodePeerVariantWasCreated.php @@ -24,6 +24,7 @@ use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -37,7 +38,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public OriginDimensionSpacePoint $sourceOrigin, @@ -56,7 +57,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -76,7 +77,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), OriginDimensionSpacePoint::fromArray($values['sourceOrigin']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeSpecializationVariantWasCreated.php b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeSpecializationVariantWasCreated.php index 709bef915d5..d034fb731d0 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeSpecializationVariantWasCreated.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeVariation/Event/NodeSpecializationVariantWasCreated.php @@ -24,6 +24,7 @@ use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -39,7 +40,7 @@ EmbedsWorkspaceName { public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public OriginDimensionSpacePoint $sourceOrigin, @@ -58,7 +59,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -78,7 +79,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): self { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), OriginDimensionSpacePoint::fromArray($values['sourceOrigin']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php index 9bbb1f320cc..7eb01f2827c 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php +++ b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/CreateRootNodeAggregateWithNode.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -36,13 +37,13 @@ RebasableToOtherWorkspaceInterface { /** - * @param WorkspaceName $workspaceName The workspace in which the root node should be created in + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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 * @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()}) */ private function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public NodeTypeName $nodeTypeName, public NodeAggregateIdsByNodePaths $tetheredDescendantNodeAggregateIds, @@ -50,11 +51,11 @@ private function __construct( } /** - * @param WorkspaceName $workspaceName The workspace in which the root node should be created in + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace 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(WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName): self + public static function create(WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeTypeName $nodeTypeName): self { return new self( $workspaceName, @@ -126,7 +127,7 @@ public function jsonSerialize(): array } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php index 302c05ed895..176637b2d98 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php +++ b/Neos.ContentRepository.Core/Classes/Feature/RootNodeCreation/Command/UpdateRootNodeAggregateDimensions.php @@ -18,6 +18,7 @@ use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -71,7 +72,7 @@ public function jsonSerialize(): array } public function createCopyForWorkspace( - WorkspaceName $targetWorkspaceName, + WorkspaceName|VirtualWorkspaceName $targetWorkspaceName, ): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/TagSubtree.php b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/TagSubtree.php index 71fb012b0cc..c451323b4d7 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/TagSubtree.php +++ b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/TagSubtree.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -78,7 +79,7 @@ public static function fromArray(array $array): self ); } - public function createCopyForWorkspace(WorkspaceName $targetWorkspaceName): self + public function createCopyForWorkspace(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/UntagSubtree.php b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/UntagSubtree.php index cca49333c95..257b8a1c584 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/UntagSubtree.php +++ b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Command/UntagSubtree.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -79,7 +80,7 @@ public static function fromArray(array $array): self ); } - public function createCopyForWorkspace(WorkspaceName $targetWorkspaceName): self + public function createCopyForWorkspace(WorkspaceName|VirtualWorkspaceName $targetWorkspaceName): self { return new self( $targetWorkspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasTagged.php b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasTagged.php index 78e9891a8d7..ed51059e97a 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasTagged.php +++ b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasTagged.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -44,7 +45,7 @@ * @param SubtreeTag $tag The tag that was added */ public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public DimensionSpacePointSet $affectedDimensionSpacePoints, @@ -62,7 +63,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -81,7 +82,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): EventInterface { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), DimensionSpacePointSet::fromArray($values['affectedDimensionSpacePoints']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasUntagged.php b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasUntagged.php index 7e0b777b9f1..4e6c11ae6cd 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasUntagged.php +++ b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Event/SubtreeWasUntagged.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -45,7 +46,7 @@ * @param SubtreeTag $tag The tag that was removed */ public function __construct( - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public ContentStreamId $contentStreamId, public NodeAggregateId $nodeAggregateId, public DimensionSpacePointSet $affectedDimensionSpacePoints, @@ -63,7 +64,7 @@ public function getNodeAggregateId(): NodeAggregateId return $this->nodeAggregateId; } - public function getWorkspaceName(): WorkspaceName + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName { return $this->workspaceName; } @@ -82,7 +83,7 @@ public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspa public static function fromArray(array $values): EventInterface { return new self( - WorkspaceName::fromString($values['workspaceName']), + VirtualWorkspaceName::isVirtual($values['workspaceName']) ? VirtualWorkspaceName::fromString($values['workspaceName']) : WorkspaceName::fromString($values['workspaceName']), ContentStreamId::fromString($values['contentStreamId']), NodeAggregateId::fromString($values['nodeAggregateId']), DimensionSpacePointSet::fromArray($values['affectedDimensionSpacePoints']), diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 16adec683e7..fa734ef598e 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -71,6 +71,7 @@ use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceDescription; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceTitle; use Neos\EventStore\EventStoreInterface; use Neos\EventStore\Exception\ConcurrencyException; @@ -473,14 +474,11 @@ private function handlePublishIndividualNodesFromWorkspace( /** @var array $remainingCommands */ // 3) fork a temporary workspace, based on the base WS, and apply MATCHING - $matchingWorkspaceName = WorkspaceName::transliterateFromString('tmp' . str_replace('-', '', $command->contentStreamIdForMatchingPart->value)); + $matchingWorkspaceName = VirtualWorkspaceName::fromContentStreamId($command->contentStreamIdForMatchingPart); $commandHandlingDependencies->handle( - CreateWorkspace::create( - $matchingWorkspaceName, - $baseWorkspace->workspaceName, - WorkspaceTitle::fromString('tmp'), - WorkspaceDescription::fromString(''), - $command->contentStreamIdForMatchingPart + ForkContentStream::create( + $command->contentStreamIdForMatchingPart, + $baseWorkspace->currentContentStreamId ) ); @@ -504,23 +502,32 @@ private function handlePublishIndividualNodesFromWorkspace( $baseWorkspace->currentContentStreamId ); - // 6) fork a new content stream, based on the base WS, and apply REST + // 6) fork a new content stream, based on the base WS to become attached to the published workspace + $commandHandlingDependencies->handle( + DiscardWorkspace::create($command->workspaceName) + ->withNewContentStreamId($command->contentStreamIdForRemainingPart) + ); + + // 7) fork a new (temporary) content stream, based on the clean WS above, and apply REST + $virtualWorkspaceContentStreamId = ContentStreamId::create(); + $virtualWorkspaceForRemaining = VirtualWorkspaceName::fromContentStreamId($virtualWorkspaceContentStreamId); $commandHandlingDependencies->handle( ForkContentStream::create( - $command->contentStreamIdForRemainingPart, - $baseWorkspace->currentContentStreamId + $virtualWorkspaceContentStreamId, + $command->contentStreamIdForRemainingPart ) ); - // 7) apply REMAINING commands to the workspace's new content stream - $commandHandlingDependencies->overrideContentStreamId( + // 8) apply REMAINING commands to the workspace's new content stream + foreach ($remainingCommands as $remainingCommand) { + $commandHandlingDependencies->handle($remainingCommand->createCopyForWorkspace($virtualWorkspaceForRemaining)); + } + + // 9) publish virtual workspace into clean REMAINING workspace + $this->publishContentStream( + $virtualWorkspaceContentStreamId, $command->workspaceName, - $command->contentStreamIdForRemainingPart, - function () use ($commandHandlingDependencies, $remainingCommands) { - foreach ($remainingCommands as $remainingCommand) { - $commandHandlingDependencies->handle($remainingCommand); - } - } + $command->contentStreamIdForRemainingPart ); } catch (\Exception $exception) { // 4.E) In case of an exception, reopen the old content stream and remove the newly created @@ -548,28 +555,27 @@ function () use ($commandHandlingDependencies, $remainingCommands) { // 8) to avoid dangling content streams, we need to remove our temporary workspace (whose events // have already been published) as well as the old content stream - $commandHandlingDependencies->handle(DeleteWorkspace::create( - $matchingWorkspaceName - )); $commandHandlingDependencies->handle(RemoveContentStream::create( - $oldWorkspaceContentStreamId + $command->contentStreamIdForMatchingPart )); $streamName = WorkspaceEventStreamName::fromWorkspaceName($command->workspaceName)->getEventStreamName(); - - return new EventsToPublish( - $streamName, - Events::fromArray([ - new WorkspaceWasPartiallyPublished( - $command->workspaceName, - $baseWorkspace->workspaceName, - $command->contentStreamIdForRemainingPart, - $oldWorkspaceContentStreamId, - $command->nodesToPublish - ) - ]), - ExpectedVersion::ANY() - ); +// +// return new EventsToPublish( +// $streamName, +// Events::fromArray([ +// new WorkspaceWasPartiallyPublished( +// $command->workspaceName, +// $baseWorkspace->workspaceName, +// $command->contentStreamIdForRemainingPart, +// $oldWorkspaceContentStreamId, +// $command->nodesToPublish +// ) +// ]), +// ExpectedVersion::ANY() +// ); + + return new EventsToPublish($streamName, Events::fromArray([]), ExpectedVersion::ANY()); } /** diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php index 67af3f6d5ff..46504803057 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php @@ -25,6 +25,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -47,7 +48,7 @@ public function getContentRepositoryId(): ContentRepositoryId; * The workspace this content graph is operating on * @api */ - public function getWorkspaceName(): WorkspaceName; + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName; /** * @api main API method of ContentGraph diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php index c47c0771932..c370eadded2 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -51,7 +52,7 @@ interface ContentSubgraphInterface { public function getContentRepositoryId(): ContentRepositoryId; - public function getWorkspaceName(): WorkspaceName; + public function getWorkspaceName(): WorkspaceName|VirtualWorkspaceName; public function getDimensionSpacePoint(): DimensionSpacePoint; diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php index e22058fda92..0dba7b652fa 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php @@ -23,6 +23,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Node\PropertyName; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -69,7 +70,7 @@ { /** * @param ContentRepositoryId $contentRepositoryId The content-repository this Node belongs to - * @param WorkspaceName $workspaceName The workspace of this Node + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace of this Node * @param DimensionSpacePoint $dimensionSpacePoint DimensionSpacePoint a node has been accessed in * @param NodeAggregateId $aggregateId NodeAggregateId (identifier) of this node. This is part of the node's "Read Model" identity, which is defined in {@see NodeAddress} * @param OriginDimensionSpacePoint $originDimensionSpacePoint The DimensionSpacePoint the node originates in. Usually needed to address a Node in a NodeAggregate in order to update it. @@ -83,7 +84,7 @@ */ private function __construct( public ContentRepositoryId $contentRepositoryId, - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public DimensionSpacePoint $dimensionSpacePoint, public NodeAggregateId $aggregateId, public OriginDimensionSpacePoint $originDimensionSpacePoint, @@ -103,7 +104,7 @@ private function __construct( /** * @internal The signature of this method can change in the future! */ - public static function create(ContentRepositoryId $contentRepositoryId, WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $aggregateId, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateClassification $classification, NodeTypeName $nodeTypeName, PropertyCollection $properties, ?NodeName $name, NodeTags $tags, Timestamps $timestamps, VisibilityConstraints $visibilityConstraints): self + public static function create(ContentRepositoryId $contentRepositoryId, WorkspaceName|VirtualWorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $aggregateId, OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateClassification $classification, NodeTypeName $nodeTypeName, PropertyCollection $properties, ?NodeName $name, NodeTags $tags, Timestamps $timestamps, VisibilityConstraints $visibilityConstraints): self { return new self($contentRepositoryId, $workspaceName, $dimensionSpacePoint, $aggregateId, $originDimensionSpacePoint, $classification, $nodeTypeName, $properties, $name, $tags, $timestamps, $visibilityConstraints); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeAggregate.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeAggregate.php index c949bac0f57..f60db61ed5e 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeAggregate.php @@ -27,6 +27,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -55,7 +56,7 @@ { /** * @param ContentRepositoryId $contentRepositoryId The content-repository this node aggregate belongs to - * @param WorkspaceName $workspaceName The workspace of this node aggregate + * @param WorkspaceName|VirtualWorkspaceName $workspaceName The workspace of this node aggregate * @param NodeAggregateId $nodeAggregateId ID of this node aggregate * @param NodeAggregateClassification $classification whether this node aggregate represents a root, regular or tethered node * @param NodeTypeName $nodeTypeName name of the node type of this node aggregate @@ -70,7 +71,7 @@ */ private function __construct( public ContentRepositoryId $contentRepositoryId, - public WorkspaceName $workspaceName, + public WorkspaceName|VirtualWorkspaceName $workspaceName, public NodeAggregateId $nodeAggregateId, public NodeAggregateClassification $classification, public NodeTypeName $nodeTypeName, @@ -92,7 +93,7 @@ private function __construct( */ public static function create( ContentRepositoryId $contentRepositoryId, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId, NodeAggregateClassification $classification, NodeTypeName $nodeTypeName, diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php index 3def569da87..370b63616eb 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php @@ -23,6 +23,7 @@ final class WorkspaceDoesNotExist extends \DomainException { public static function butWasSupposedTo(WorkspaceName $name): self { + debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10); return new self(sprintf( 'The source workspace %s does not exist', $name->value diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAddress.php b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAddress.php index fcce795b58c..3c75f594e85 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAddress.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAddress.php @@ -7,6 +7,7 @@ use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -51,6 +52,10 @@ public static function create( public static function fromNode(Node $node): self { + if ($node->workspaceName instanceof VirtualWorkspaceName) { + throw new \InvalidArgumentException('Can only create NodeAdress from node in existing workspace', 1729361386); + } + return new self( $node->contentRepositoryId, $node->workspaceName, diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/VirtualWorkspaceName.php b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/VirtualWorkspaceName.php new file mode 100644 index 00000000000..b7121b8805d --- /dev/null +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/VirtualWorkspaceName.php @@ -0,0 +1,53 @@ +contentStreamId->value); + $this->value = self::VIRTUAL_PREFIX . $identifierBase64; + } + + public static function fromString(string $value): self + { + if (!self::isVirtual($value)) { + throw new \InvalidArgumentException('This is not a virtual workspace name: ' . $value, 1729286719); + } + $identifier = base64_decode(substr($value, strlen(self::VIRTUAL_PREFIX))); + return new self(ContentStreamId::fromString($identifier)); + } + + public static function fromContentStreamId(ContentStreamId $contentStreamId): self + { + return new self($contentStreamId); + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function isVirtual(string $value): bool + { + return str_starts_with($value, self::VIRTUAL_PREFIX); + } + + public function isLive(): bool + { + return false; + } +} diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php index 1a5b65999d4..a92c8c81f00 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php @@ -15,6 +15,9 @@ namespace Neos\ContentRepository\Core\SharedModel\Workspace; use Behat\Transliterator\Transliterator; +use http\Exception\RuntimeException; +use Ramsey\Uuid\Uuid; +use Ramsey\Uuid\UuidFactory; /** * Name of a workspace. @@ -38,6 +41,9 @@ final class WorkspaceName implements \JsonSerializable private function __construct( public readonly string $value ) { + if (VirtualWorkspaceName::isVirtual($value)) { + throw new \InvalidArgumentException(sprintf('Invalid workspace name "%s" given. This is a virtual workspace name', $value), 1729289746); + } if (!self::hasValidFormat($value)) { throw new \InvalidArgumentException(sprintf('Invalid workspace name "%s" given. A workspace name has to consist of at most %d lower case characters', $value, self::MAX_LENGTH), 1505826610); } diff --git a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php index 95a7e5336a5..8c252d30de7 100644 --- a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php +++ b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php @@ -4,6 +4,7 @@ namespace Neos\ContentRepository\StructureAdjustment\Adjustment; +use http\Exception\InvalidArgumentException; use Neos\ContentRepository\Core\DimensionSpace; use Neos\ContentRepository\Core\EventStore\Events; use Neos\ContentRepository\Core\EventStore\EventsToPublish; @@ -21,6 +22,7 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\EventStore\Model\EventStream\ExpectedVersion; @@ -36,6 +38,9 @@ public function __construct( private readonly DimensionSpace\InterDimensionalVariationGraph $interDimensionalVariationGraph, private readonly PropertyConverter $propertyConverter ) { + if ($this->contentGraph->getWorkspaceName() instanceof VirtualWorkspaceName) { + throw new InvalidArgumentException('Adjustment needs to be applied to an existing workspace.', 1729361212); + } } /** diff --git a/Neos.Neos/Classes/AssetUsage/CatchUpHook/AssetUsageCatchUpHook.php b/Neos.Neos/Classes/AssetUsage/CatchUpHook/AssetUsageCatchUpHook.php index e240adb41bc..279bbacc511 100644 --- a/Neos.Neos/Classes/AssetUsage/CatchUpHook/AssetUsageCatchUpHook.php +++ b/Neos.Neos/Classes/AssetUsage/CatchUpHook/AssetUsageCatchUpHook.php @@ -26,6 +26,7 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\EventStore\Model\EventEnvelope; use Neos\Neos\AssetUsage\Service\AssetUsageIndexingService; @@ -47,6 +48,9 @@ public function onBeforeCatchUp(): void public function onBeforeEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope): void { + if ($eventInstance instanceof EmbedsWorkspaceName && $eventInstance->workspaceName instanceof VirtualWorkspaceName) { + return; + } if ($eventInstance instanceof EmbedsWorkspaceName && $eventInstance instanceof EmbedsContentStreamId) { // Safeguard for temporary content streams created during partial publish -> We want to skip these events, because their workspace doesn't match current content stream. try { @@ -68,6 +72,9 @@ public function onBeforeEvent(EventInterface $eventInstance, EventEnvelope $even public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope): void { + if ($eventInstance instanceof EmbedsWorkspaceName && $eventInstance->workspaceName instanceof VirtualWorkspaceName) { + return; + } if ($eventInstance instanceof EmbedsWorkspaceName && $eventInstance instanceof EmbedsContentStreamId) { // Safeguard for temporary content streams created during partial publish -> We want to skip these events, because their workspace doesn't match current content stream. try { diff --git a/Neos.Neos/Classes/AssetUsage/Service/AssetUsageIndexingService.php b/Neos.Neos/Classes/AssetUsage/Service/AssetUsageIndexingService.php index a6c42ef5523..486ef3f6b65 100644 --- a/Neos.Neos/Classes/AssetUsage/Service/AssetUsageIndexingService.php +++ b/Neos.Neos/Classes/AssetUsage/Service/AssetUsageIndexingService.php @@ -13,6 +13,7 @@ use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Persistence\Doctrine\PersistenceManager; @@ -55,6 +56,10 @@ public function __construct( public function updateIndex(ContentRepositoryId $contentRepositoryId, Node $node): void { + if ($node->workspaceName instanceof VirtualWorkspaceName) { + return; + } + $workspaceBases = $this->getWorkspaceBasesAndWorkspace($contentRepositoryId, $node->workspaceName); $workspaceDependents = $this->getWorkspaceDependents($contentRepositoryId, $node->workspaceName); $nodeType = $this->contentRepositoryRegistry->get($contentRepositoryId)->getNodeTypeManager()->getNodeType($node->nodeTypeName); diff --git a/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php b/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php index e3e8bcfe461..663abb4bec2 100644 --- a/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php +++ b/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php @@ -41,6 +41,7 @@ use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds; +use Neos\ContentRepository\Core\SharedModel\Workspace\VirtualWorkspaceName; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\EventStore\Model\EventEnvelope; @@ -169,7 +170,7 @@ public function onBeforeEvent(EventInterface $eventInstance, EventEnvelope $even $nodeAggregate = $contentGraph->findNodeAggregateById( $eventInstance->getNodeAggregateId() ); - if ($nodeAggregate) { + if ($nodeAggregate && !($eventInstance->workspaceName instanceof VirtualWorkspaceName)) { $this->scheduleCacheFlushJobForNodeAggregate( $this->contentRepository, $eventInstance->workspaceName, @@ -211,7 +212,7 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event return; } - if ($nodeAggregate) { + if ($nodeAggregate && !($eventInstance->getWorkspaceName() instanceof VirtualWorkspaceName)) { $this->scheduleCacheFlushJobForNodeAggregate( $this->contentRepository, $eventInstance->getWorkspaceName(), @@ -223,7 +224,7 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event private function scheduleCacheFlushJobForNodeAggregate( ContentRepository $contentRepository, - WorkspaceName $workspaceName, + WorkspaceName|VirtualWorkspaceName $workspaceName, NodeAggregate $nodeAggregate ): void { // we store this in an associative array deduplicate.