From d8663b91ddcef26d044855d5476266f38ac0c23c Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 20 May 2024 19:44:42 +0200 Subject: [PATCH] TASK: 5051 make subgraph not jsonSerializeable --- .../src/Domain/Repository/ContentSubgraph.php | 11 ---------- .../Repository/ContentSubhypergraph.php | 11 ---------- .../ContentSubgraphWithRuntimeCaches.php | 8 -------- .../ContentGraph/ContentSubgraphInterface.php | 8 +------- .../ViewHelpers/Link/NodeViewHelper.php | 20 +++++++++++-------- .../ViewHelpers/Uri/NodeViewHelper.php | 10 ++++++---- .../Behavior/Bootstrap/FeatureContext.php | 4 ++-- 7 files changed, 21 insertions(+), 51 deletions(-) diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php index 57774559fa8..07af410be7a 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php @@ -439,17 +439,6 @@ public function countNodes(): int return $result; } - /** - * @return array - */ - public function jsonSerialize(): array - { - return [ - 'workspaceName' => $this->workspaceName, - 'dimensionSpacePoint' => $this->dimensionSpacePoint, - ]; - } - /** ------------------------------------------- */ private function findNodeByPathFromStartingNode(NodePath $path, Node $startingNode): ?Node diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php index b7971989a59..8b312166d2a 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php @@ -539,15 +539,4 @@ private function findNodeByPathFromStartingNode(NodePath $path, Node $startingNo } return $currentNode; } - - /** - * @return array - */ - public function jsonSerialize(): array - { - return [ - 'workspaceName' => $this->workspaceName, - 'dimensionSpacePoint' => $this->dimensionSpacePoint, - ]; - } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php index 577ad312e92..5cff72e70b9 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/ContentSubgraphWithRuntimeCaches.php @@ -264,12 +264,4 @@ private static function isFilterEmpty(object $filter): bool { return array_filter(get_object_vars($filter), static fn ($value) => $value !== null) === []; } - - /** - * @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 083e85cdcf2..c47c0771932 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentSubgraphInterface.php @@ -47,7 +47,7 @@ * * @api */ -interface ContentSubgraphInterface extends \JsonSerializable +interface ContentSubgraphInterface { public function getContentRepositoryId(): ContentRepositoryId; @@ -203,10 +203,4 @@ public function retrieveNodePath(NodeAggregateId $nodeAggregateId): AbsoluteNode * @internal this method might change without further notice. */ public function countNodes(): int; - - /** - * @deprecated will be removed before Neos 9 release - * @return array - */ - public function jsonSerialize(): array; } diff --git a/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php index 305fd2ea5e5..d0786371c7f 100644 --- a/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php @@ -293,9 +293,10 @@ public function render(): string $resolvedNode = $subgraph->findNodeById($nodeAddress->nodeAggregateId); if ($resolvedNode === null) { $this->throwableStorage->logThrowable(new ViewHelperException(sprintf( - 'Failed to resolve node "%s" on subgraph "%s"', + 'Failed to resolve node "%s" in workspace "%s" and dimension %s', $nodeAddress->nodeAggregateId->value, - json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) + $subgraph->getWorkspaceName()->value, + $subgraph->getDimensionSpacePoint()->toJson() ), 1601372444)); } if ($resolvedNode && $this->getNodeType($resolvedNode)->isOfType(NodeTypeNameFactory::NAME_SHORTCUT)) { @@ -310,9 +311,10 @@ public function render(): string } } catch (NodeNotFoundException | InvalidShortcutException $e) { $this->throwableStorage->logThrowable(new ViewHelperException(sprintf( - 'Failed to resolve shortcut node "%s" on subgraph "%s"', + 'Failed to resolve shortcut node "%s" in workspace "%s" and dimension %s', $resolvedNode->aggregateId->value, - json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) + $subgraph->getWorkspaceName()->value, + $subgraph->getDimensionSpacePoint()->toJson() ), 1601370239, $e)); } } @@ -384,9 +386,10 @@ private function resolveNodeAddressFromString( $siteNode = $subgraph->findClosestNode($documentNodeAddress->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_SITE)); if ($siteNode === null) { throw new ViewHelperException(sprintf( - 'Failed to determine site node for aggregate node "%s" and subgraph "%s"', + 'Failed to determine site node for aggregate node "%s" in workspace "%s" and dimension %s', $documentNodeAddress->nodeAggregateId->value, - json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) + $subgraph->getWorkspaceName()->value, + $subgraph->getDimensionSpacePoint()->toJson() ), 1601366598); } if ($path === '~') { @@ -405,10 +408,11 @@ private function resolveNodeAddressFromString( } if ($targetNode === null) { throw new ViewHelperException(sprintf( - 'Node on path "%s" could not be found for aggregate node "%s" and subgraph "%s"', + 'Node on path "%s" could not be found for aggregate node "%s" in workspace "%s" and dimension %s', $path, $documentNodeAddress->nodeAggregateId->value, - json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) + $subgraph->getWorkspaceName()->value, + $subgraph->getDimensionSpacePoint()->toJson() ), 1601311789); } return $documentNodeAddress->withNodeAggregateId($targetNode->aggregateId); diff --git a/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php index 39ec88d9b05..e7d90c679d4 100644 --- a/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php @@ -281,9 +281,10 @@ private function resolveNodeAddressFromString(string $path): ?NodeAddress $siteNode = $subgraph->findClosestNode($documentNodeAddress->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_SITE)); if ($siteNode === null) { throw new ViewHelperException(sprintf( - 'Failed to determine site node for aggregate node "%s" and subgraph "%s"', + 'Failed to determine site node for aggregate node "%s" in workspace "%s" and dimension %s', $documentNodeAddress->nodeAggregateId->value, - json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) + $subgraph->getWorkspaceName()->value, + $subgraph->getDimensionSpacePoint()->toJson() ), 1601366598); } if ($path === '~') { @@ -302,10 +303,11 @@ private function resolveNodeAddressFromString(string $path): ?NodeAddress } if ($targetNode === null) { $this->throwableStorage->logThrowable(new ViewHelperException(sprintf( - 'Node on path "%s" could not be found for aggregate node "%s" and subgraph "%s"', + 'Node on path "%s" could not be found for aggregate node "%s" in workspace "%s" and dimension %s', $path, $documentNodeAddress->nodeAggregateId->value, - json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) + $subgraph->getWorkspaceName()->value, + $subgraph->getDimensionSpacePoint()->toJson() ), 1601311789)); return null; } diff --git a/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php b/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php index d9c7192c968..6e3ce6ff3a6 100644 --- a/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php +++ b/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php @@ -63,7 +63,7 @@ public function iExpectThisNodeToBeEnabled(): void VisibilityConstraints::withoutRestrictions(), ); $currentNode = $subgraph->findNodeById($this->currentNode->aggregateId); - Assert::assertNotNull($currentNode, sprintf('Failed to find node with id "%s" in subgraph %s', $this->currentNode->aggregateId->value, json_encode($subgraph))); + Assert::assertNotNull($currentNode, sprintf('Failed to find node with id "%s" in workspace %s and dimension %s', $this->currentNode->aggregateId->value, $subgraph->getWorkspaceName()->value, $subgraph->getDimensionSpacePoint()->toJson())); Assert::assertFalse($currentNode->tags->contain(SubtreeTag::disabled()), sprintf('Node "%s" was expected to be enabled, but it is not', $this->currentNode->aggregateId->value)); } @@ -78,7 +78,7 @@ public function iExpectThisNodeToBeDisabled(): void VisibilityConstraints::withoutRestrictions(), ); $currentNode = $subgraph->findNodeById($this->currentNode->aggregateId); - Assert::assertNotNull($currentNode, sprintf('Failed to find node with id "%s" in subgraph %s', $this->currentNode->aggregateId->value, json_encode($subgraph))); + Assert::assertNotNull($currentNode, sprintf('Failed to find node with id "%s" in workspace %s and dimension %s', $this->currentNode->aggregateId->value, $subgraph->getWorkspaceName()->value, $subgraph->getDimensionSpacePoint()->toJson())); Assert::assertTrue($currentNode->tags->contain(SubtreeTag::disabled()), sprintf('Node "%s" was expected to be disabled, but it is not', $this->currentNode->aggregateId->value)); }