diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php index 326f5e52f9c..611afd7c761 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php @@ -84,6 +84,16 @@ public function __construct( $this->nodeQueryBuilder = new NodeQueryBuilder($this->client->getConnection(), $this->tableNames); } + public function getContentRepositoryId(): ContentRepositoryId + { + return $this->contentRepositoryId; + } + + public function getWorkspaceName(): WorkspaceName + { + return $this->workspaceName; + } + public function getSubgraph( DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints @@ -362,13 +372,6 @@ private function fetchRows(QueryBuilder $queryBuilder): array } } - /** The workspace this content graph is operating on */ - public function getWorkspaceName(): WorkspaceName - { - return $this->workspaceName; - } - - /** @internal The content stream id where the workspace name points to for this instance */ public function getContentStreamId(): ContentStreamId { return $this->contentStreamId; diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php index 3e003e51bbb..322ed95e789 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php @@ -104,14 +104,24 @@ public function __construct( $this->nodeQueryBuilder = new NodeQueryBuilder($this->client->getConnection(), $tableNames); } - public function getIdentity(): ContentSubgraphIdentity + public function getContentRepositoryId(): ContentRepositoryId { - return ContentSubgraphIdentity::create( - $this->contentRepositoryId, - $this->contentStreamId, - $this->dimensionSpacePoint, - $this->visibilityConstraints - ); + return $this->contentRepositoryId; + } + + public function getWorkspaceName(): WorkspaceName + { + return $this->workspaceName; + } + + public function getDimensionSpacePoint(): DimensionSpacePoint + { + return $this->dimensionSpacePoint; + } + + public function getVisibilityConstraints(): VisibilityConstraints + { + return $this->visibilityConstraints; } public function findChildNodes(NodeAggregateId $parentNodeAggregateId, FindChildNodesFilter $filter): Nodes @@ -429,9 +439,15 @@ public function countNodes(): int return $result; } - public function jsonSerialize(): ContentSubgraphIdentity + /** + * @return array + */ + public function jsonSerialize(): array { - return $this->getIdentity(); + return [ + 'workspaceName' => $this->workspaceName, + 'dimensionSpacePoint' => $this->dimensionSpacePoint, + ]; } /** ------------------------------------------- */ diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php index 678b3d69adc..8ed8bc21557 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php @@ -68,6 +68,16 @@ public function __construct( $this->nodeFactory = $nodeFactory; } + public function getContentRepositoryId(): ContentRepositoryId + { + return $this->contentRepositoryId; + } + + public function getWorkspaceName(): WorkspaceName + { + return $this->workspaceName; + } + public function getSubgraph( DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints @@ -77,6 +87,7 @@ public function getSubgraph( $this->subhypergraphs[$index] = new ContentSubhypergraph( $this->contentRepositoryId, $this->contentStreamId, + $this->workspaceName, $dimensionSpacePoint, $visibilityConstraints, $this->databaseClient, @@ -307,11 +318,6 @@ private function getDatabaseConnection(): DatabaseConnection return $this->databaseClient->getConnection(); } - public function getWorkspaceName(): WorkspaceName - { - return $this->workspaceName; - } - public function getContentStreamId(): ContentStreamId { return $this->contentStreamId; diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php index 95d96cbf077..b25c7452294 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php @@ -52,6 +52,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\WorkspaceName; /** * The content subgraph application repository @@ -76,6 +77,7 @@ public function __construct( private ContentRepositoryId $contentRepositoryId, private ContentStreamId $contentStreamId, + private WorkspaceName $workspaceName, private DimensionSpacePoint $dimensionSpacePoint, private VisibilityConstraints $visibilityConstraints, private PostgresDbalClientInterface $databaseClient, @@ -85,14 +87,24 @@ public function __construct( ) { } - public function getIdentity(): ContentSubgraphIdentity + public function getContentRepositoryId(): ContentRepositoryId { - return ContentSubgraphIdentity::create( - $this->contentRepositoryId, - $this->contentStreamId, - $this->dimensionSpacePoint, - $this->visibilityConstraints - ); + return $this->contentRepositoryId; + } + + public function getWorkspaceName(): WorkspaceName + { + return $this->workspaceName; + } + + public function getDimensionSpacePoint(): DimensionSpacePoint + { + return $this->dimensionSpacePoint; + } + + public function getVisibilityConstraints(): VisibilityConstraints + { + return $this->visibilityConstraints; } public function findNodeById(NodeAggregateId $nodeAggregateId): ?Node @@ -534,8 +546,14 @@ private function getDatabaseConnection(): DatabaseConnection return $this->databaseClient->getConnection(); } - public function jsonSerialize(): ContentSubgraphIdentity + /** + * @return array + */ + public function jsonSerialize(): array { - return $this->getIdentity(); + return [ + 'workspaceName' => $this->workspaceName, + 'dimensionSpacePoint' => $this->dimensionSpacePoint, + ]; } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php index 4913da031cf..6a5ef9a7948 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php @@ -19,6 +19,7 @@ use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint; use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\Projection\ProjectionStateInterface; +use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregatesTypeIsAmbiguous; use Neos\ContentRepository\Core\SharedModel\Exception\RootNodeAggregateDoesNotExist; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; @@ -37,6 +38,17 @@ */ interface ContentGraphInterface extends ProjectionStateInterface { + /** + * @api + */ + public function getContentRepositoryId(): ContentRepositoryId; + + /** + * The workspace this content graph is operating on + * @api + */ + public function getWorkspaceName(): WorkspaceName; + /** * @api main API method of ContentGraph */ @@ -149,9 +161,6 @@ public function getDimensionSpacePointsOccupiedByChildNodeName( */ public function countNodes(): int; - /** The workspace this content graph is operating on */ - public function getWorkspaceName(): WorkspaceName; - /** @internal The content stream id where the workspace name points to for this instance */ public function getContentStreamId(): ContentStreamId; } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php index 96ec21720d7..72510b43e62 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php @@ -14,9 +14,9 @@ namespace Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphWithRuntimeCaches; +use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\Projection\ContentGraph\AbsoluteNodePath; -use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphIdentity; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\CountBackReferencesFilter; @@ -34,8 +34,11 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes; use Neos\ContentRepository\Core\Projection\ContentGraph\References; use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree; +use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; +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\WorkspaceName; /** * Wrapper for a concrete implementation of the {@see ContentSubgraphInterface} that @@ -53,9 +56,24 @@ public function __construct( $this->inMemoryCache = new InMemoryCache(); } - public function getIdentity(): ContentSubgraphIdentity + public function getContentRepositoryId(): ContentRepositoryId { - return $this->wrappedContentSubgraph->getIdentity(); + return $this->wrappedContentSubgraph->getContentRepositoryId(); + } + + public function getWorkspaceName(): WorkspaceName + { + return $this->wrappedContentSubgraph->getWorkspaceName(); + } + + public function getDimensionSpacePoint(): DimensionSpacePoint + { + return $this->wrappedContentSubgraph->getDimensionSpacePoint(); + } + + public function getVisibilityConstraints(): VisibilityConstraints + { + return $this->wrappedContentSubgraph->getVisibilityConstraints(); } public function findChildNodes(NodeAggregateId $parentNodeAggregateId, FindChildNodesFilter $filter): Nodes @@ -247,7 +265,10 @@ private static function isFilterEmpty(object $filter): bool return array_filter(get_object_vars($filter), static fn ($value) => $value !== null) === []; } - public function jsonSerialize(): ContentSubgraphIdentity + /** + * @return array + */ + public function jsonSerialize(): array { return $this->wrappedContentSubgraph->jsonSerialize(); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php index 79a1427ec93..9934276c7f2 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php @@ -17,9 +17,10 @@ use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Feature\RootNodeCreation\RootNodeHandling; use Neos\ContentRepository\Core\NodeType\NodeTypeName; +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\ContentStreamId; +use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** * This is the most important read model of a content repository. @@ -46,16 +47,15 @@ * * @api */ -interface ContentSubgraphInterface extends \JsonSerializable +interface ContentSubgraphInterface { - /** - * Returns the subgraph's identity, i.e. the current perspective we look at content from, composed of - * * the content repository the subgraph belongs to - * * the ID of the content stream we are currently working in - * * the dimension space point we are currently looking at - * * the applied visibility constraints - */ - public function getIdentity(): ContentSubgraphIdentity; + public function getContentRepositoryId(): ContentRepositoryId; + + public function getWorkspaceName(): WorkspaceName; + + public function getDimensionSpacePoint(): DimensionSpacePoint; + + public function getVisibilityConstraints(): VisibilityConstraints; /** * Find a single node by its aggregate id @@ -204,5 +204,9 @@ public function retrieveNodePath(NodeAggregateId $nodeAggregateId): AbsoluteNode */ public function countNodes(): int; - public function jsonSerialize(): ContentSubgraphIdentity; + /** + * @deprecated will be removed before Neos 9 release + * @return array + */ + public function jsonSerialize(): array; } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php index 4b5c511b7e0..c3f5908b6e1 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php @@ -201,8 +201,8 @@ protected function getEntryPoints(array $contextNodes): array foreach ($contextNodes as $contextNode) { assert($contextNode instanceof Node); $subgraph = $this->contentRepositoryRegistry->subgraphForNode($contextNode); - $subgraphIdentifier = md5($subgraph->getIdentity()->contentStreamId->value - . '@' . $contextNode->dimensionSpacePoint->toJson()); + $subgraphIdentifier = md5($subgraph->getWorkspaceName()->value + . '@' . $subgraph->getDimensionSpacePoint()->toJson()); if (!isset($entryPoints[(string) $subgraphIdentifier])) { $entryPoints[(string) $subgraphIdentifier] = [ 'subgraph' => $subgraph,