Skip to content

Commit

Permalink
Merge pull request #5066 from neos/task/removeReferencesToDeprecateNo…
Browse files Browse the repository at this point in the history
…deReadModelProperties

TASK: Remove references to deprecate node read model properties
  • Loading branch information
mhsdesign committed May 19, 2024
2 parents d10bc0f + e28fc44 commit 008d9bf
Show file tree
Hide file tree
Showing 90 changed files with 252 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function retrieveNodePath(NodeAggregateId $nodeAggregateId): AbsoluteNode
1687513836
);
}
$ancestors = $this->findAncestorNodes($leafNode->nodeAggregateId, FindAncestorNodesFilter::create())
$ancestors = $this->findAncestorNodes($leafNode->aggregateId, FindAncestorNodesFilter::create())
->reverse();

try {
Expand Down Expand Up @@ -457,7 +457,7 @@ private function findNodeByPathFromStartingNode(NodePath $path, Node $startingNo
$currentNode = $startingNode;

foreach ($path->getParts() as $edgeName) {
$currentNode = $this->findChildNodeConnectedThroughEdgeName($currentNode->nodeAggregateId, $edgeName);
$currentNode = $this->findChildNodeConnectedThroughEdgeName($currentNode->aggregateId, $edgeName);
if ($currentNode === null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ private function findNodeByPathFromStartingNode(NodePath $path, Node $startingNo
$currentNode = $startingNode;
foreach ($path->getParts() as $edgeName) {
// id exists here :)
$currentNode = $this->findChildNodeConnectedThroughEdgeName($currentNode->nodeAggregateId, $edgeName);
$currentNode = $this->findChildNodeConnectedThroughEdgeName($currentNode->aggregateId, $edgeName);
if ($currentNode === null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ private function resolveInterdimensionalSiblingsForCreation(
// a) happy path, the explicitly requested succeeding sibling also exists in this dimension space point
$interdimensionalSiblings[] = new InterdimensionalSibling(
$coveredDimensionSpacePoint,
$variantSucceedingSibling->nodeAggregateId,
$variantSucceedingSibling->aggregateId,
);
continue;
}

// check the other siblings succeeding in the origin dimension space point
foreach ($originAlternativeSucceedingSiblings as $originSibling) {
$alternativeVariantSucceedingSibling = $subGraph->findNodeById($originSibling->nodeAggregateId);
$alternativeVariantSucceedingSibling = $subGraph->findNodeById($originSibling->aggregateId);
if (!$alternativeVariantSucceedingSibling) {
continue;
}
// b) one of the further succeeding sibling exists in this dimension space point
$interdimensionalSiblings[] = new InterdimensionalSibling(
$coveredDimensionSpacePoint,
$alternativeVariantSucceedingSibling->nodeAggregateId,
$alternativeVariantSucceedingSibling->aggregateId,
);
continue 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,14 @@ private function resolveInterdimensionalSiblings(
foreach ($variantCoverage as $variantDimensionSpacePoint) {
// check the siblings succeeding in the origin dimension space point
foreach ($originSiblings as $originSibling) {
$variantSibling = $contentGraph->getSubgraph($variantDimensionSpacePoint, VisibilityConstraints::withoutRestrictions())->findNodeById($originSibling->nodeAggregateId);
$variantSibling = $contentGraph->getSubgraph($variantDimensionSpacePoint, VisibilityConstraints::withoutRestrictions())->findNodeById($originSibling->aggregateId);
if (!$variantSibling) {
continue;
}
// a) one of the further succeeding sibling exists in this dimension space point
$interdimensionalSiblings[] = new InterdimensionalSibling(
$variantDimensionSpacePoint,
$variantSibling->nodeAggregateId,
$variantSibling->aggregateId,
);
continue 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ public static function fromSubgraphAndStartNode(ContentSubgraphInterface $subgra
{
$childNodes = [];
foreach (
$subgraph->findChildNodes($sourceNode->nodeAggregateId, FindChildNodesFilter::create()) as $sourceChildNode
$subgraph->findChildNodes($sourceNode->aggregateId, FindChildNodesFilter::create()) as $sourceChildNode
) {
$childNodes[] = self::fromSubgraphAndStartNode($subgraph, $sourceChildNode);
}
$properties = $sourceNode->properties;

return new self(
$sourceNode->nodeAggregateId,
$sourceNode->aggregateId,
$sourceNode->nodeTypeName,
$sourceNode->nodeName,
$sourceNode->name,
$sourceNode->classification,
$properties->serialized(),
NodeReferencesSnapshot::fromReferences(
$subgraph->findReferences($sourceNode->nodeAggregateId, FindReferencesFilter::create())
$subgraph->findReferences($sourceNode->aggregateId, FindReferencesFilter::create())
),
$childNodes
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ private function resolveInterdimensionalSiblingsForMove(
);
if ($succeedingSiblingId) {
$variantSucceedingSibling = $variantSubgraph->findNodeById($succeedingSiblingId);
$variantParentId = $parentNodeAggregateId ?: $variantSubgraph->findParentNode($nodeAggregateId)?->nodeAggregateId;
$variantParentId = $parentNodeAggregateId ?: $variantSubgraph->findParentNode($nodeAggregateId)?->aggregateId;
$siblingParent = $variantSubgraph->findParentNode($succeedingSiblingId);
if ($variantSucceedingSibling && $siblingParent && $variantParentId?->equals($siblingParent->nodeAggregateId)) {
if ($variantSucceedingSibling && $siblingParent && $variantParentId?->equals($siblingParent->aggregateId)) {
// a) happy path, the explicitly requested succeeding sibling also exists in this dimension space point
$interdimensionalSiblings[] = new InterdimensionalSibling(
$dimensionSpacePoint,
$variantSucceedingSibling->nodeAggregateId,
$variantSucceedingSibling->aggregateId,
);
continue;
}
Expand All @@ -296,13 +296,13 @@ private function resolveInterdimensionalSiblingsForMove(
continue;
}
$siblingParent = $variantSubgraph->findParentNode($alternativeSucceedingSiblingId);
if (!$siblingParent || !$variantParentId?->equals($siblingParent->nodeAggregateId)) {
if (!$siblingParent || !$variantParentId?->equals($siblingParent->aggregateId)) {
continue;
}
// b) one of the further succeeding sibling exists in this dimension space point
$interdimensionalSiblings[] = new InterdimensionalSibling(
$dimensionSpacePoint,
$alternativeVariantSucceedingSibling->nodeAggregateId,
$alternativeVariantSucceedingSibling->aggregateId,
);
continue 2;
}
Expand All @@ -311,9 +311,9 @@ private function resolveInterdimensionalSiblingsForMove(
if ($precedingSiblingId) {
$variantPrecedingSiblingId = null;
$variantPrecedingSibling = $variantSubgraph->findNodeById($precedingSiblingId);
$variantParentId = $parentNodeAggregateId ?: $variantSubgraph->findParentNode($nodeAggregateId)?->nodeAggregateId;
$variantParentId = $parentNodeAggregateId ?: $variantSubgraph->findParentNode($nodeAggregateId)?->aggregateId;
$siblingParent = $variantSubgraph->findParentNode($precedingSiblingId);
if ($variantPrecedingSibling && $siblingParent && $variantParentId?->equals($siblingParent->nodeAggregateId)) {
if ($variantPrecedingSibling && $siblingParent && $variantParentId?->equals($siblingParent->aggregateId)) {
// c) happy path, the explicitly requested preceding sibling also exists in this dimension space point
$variantPrecedingSiblingId = $precedingSiblingId;
} elseif ($alternativePrecedingSiblingIds) {
Expand All @@ -324,7 +324,7 @@ private function resolveInterdimensionalSiblingsForMove(
continue;
}
$siblingParent = $variantSubgraph->findParentNode($alternativePrecedingSiblingId);
if (!$siblingParent || !$variantParentId?->equals($siblingParent->nodeAggregateId)) {
if (!$siblingParent || !$variantParentId?->equals($siblingParent->aggregateId)) {
continue;
}
$alternativeVariantSucceedingSibling = $variantSubgraph->findNodeById($alternativePrecedingSiblingId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function handleChangeNodeAggregateType(
VisibilityConstraints::withoutRestrictions()
)->findNodeByPath(
$tetheredNodeTypeDefinition->name,
$node->nodeAggregateId,
$node->aggregateId,
);

if ($tetheredNode === null) {
Expand Down Expand Up @@ -410,7 +410,7 @@ private function findDimensionSpacePointsConnectingParentAndChildAggregate(
);
if (
$parentNode
&& $parentNode->nodeAggregateId->equals($parentNodeAggregate->nodeAggregateId)
&& $parentNode->aggregateId->equals($parentNodeAggregate->nodeAggregateId)
) {
$points[] = $coveredDimensionSpacePoint;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ public static function fromLeafNodeAndAncestors(Node $leafNode, Nodes $ancestors
if ($ancestor->classification->isRoot()) {
continue;
}
if (!$ancestor->nodeName) {
if (!$ancestor->name) {
throw new \InvalidArgumentException(
'Could not resolve node path for node ' . $leafNode->nodeAggregateId->value
. ', ancestor ' . $ancestor->nodeAggregateId->value . ' is unnamed.',
'Could not resolve node path for node ' . $leafNode->aggregateId->value
. ', ancestor ' . $ancestor->aggregateId->value . ' is unnamed.',
1687509348
);
}
$nodeNames[] = $ancestor->nodeName;
$nodeNames[] = $ancestor->name;
}

return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public function findChildNodes(NodeAggregateId $parentNodeAggregateId, FindChild
}
$childNodes = $this->wrappedContentSubgraph->findChildNodes($parentNodeAggregateId, $filter);
foreach ($childNodes as $node) {
$namedChildNodeCache->add($parentNodeAggregateId, $node->nodeName, $node);
$parentNodeIdCache->add($node->nodeAggregateId, $parentNodeAggregateId);
$nodeByIdCache->add($node->nodeAggregateId, $node);
$namedChildNodeCache->add($parentNodeAggregateId, $node->name, $node);
$parentNodeIdCache->add($node->aggregateId, $parentNodeAggregateId);
$nodeByIdCache->add($node->aggregateId, $node);
}
$childNodesCache->add($parentNodeAggregateId, $filter->nodeTypes, $childNodes);
return $childNodes;
Expand Down Expand Up @@ -174,10 +174,10 @@ public function findParentNode(NodeAggregateId $childNodeAggregateId): ?Node
$parentNodeIdCache->rememberNonExistingParentNode($childNodeAggregateId);
return null;
}
$parentNodeIdCache->add($childNodeAggregateId, $parentNode->nodeAggregateId);
$parentNodeIdCache->add($childNodeAggregateId, $parentNode->aggregateId);
// we also add the parent node to the NodeAggregateId => Node cache;
// as this might improve cache hit rates as well.
$this->inMemoryCache->getNodeByNodeAggregateIdCache()->add($parentNode->nodeAggregateId, $parentNode);
$this->inMemoryCache->getNodeByNodeAggregateIdCache()->add($parentNode->aggregateId, $parentNode);
return $parentNode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* - {@see visibilityConstraints}
*
* In addition to the above subgraph identity, a Node's read model identity is further described
* by {@see Node::$nodeAggregateId}.
* by {@see Node::$aggregateId}.
*
* With the above information, you can fetch a Subgraph directly by using
* {@see \Neos\ContentRepositoryRegistry\ContentRepositoryRegistry::subgraphForNode()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private function getNodeIndex(Node $subject): int
}
throw new \InvalidArgumentException(sprintf(
'The node %s does not exist in this set',
$subject->nodeAggregateId->value
$subject->aggregateId->value
), 1542901216);
}

Expand Down Expand Up @@ -210,7 +210,7 @@ public function map(\Closure $callback): array
public function toNodeAggregateIds(): NodeAggregateIds
{
return NodeAggregateIds::create(...$this->map(
fn (Node $node): NodeAggregateId => $node->nodeAggregateId,
fn (Node $node): NodeAggregateId => $node->aggregateId,
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function fromNode(Node $node): self
$node->contentRepositoryId,
$node->workspaceName,
$node->dimensionSpacePoint,
$node->nodeAggregateId
$node->aggregateId
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static function fromJsonString(string $jsonString): self
public static function fromNodes(Nodes $nodes): self
{
return self::fromArray(
array_map(fn(Node $node) => $node->nodeAggregateId, iterator_to_array($nodes))
array_map(fn(Node $node) => $node->aggregateId, iterator_to_array($nodes))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($contextNode);
$output[] = iterator_to_array($subgraph->findBackReferences($contextNode->nodeAggregateId, $filter));
$output[] = iterator_to_array($subgraph->findBackReferences($contextNode->aggregateId, $filter));
}
$flowQuery->setContext(array_map(fn(Reference $reference) => $reference->node, array_merge(...$output)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($contextNode);
$output[] = iterator_to_array($subgraph->findBackReferences($contextNode->nodeAggregateId, $filter));
$output[] = iterator_to_array($subgraph->findBackReferences($contextNode->aggregateId, $filter));
}
$flowQuery->setContext(array_merge(...$output));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$childNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findChildNodes($contextNode->nodeAggregateId, FindChildNodesFilter::create());
->findChildNodes($contextNode->aggregateId, FindChildNodesFilter::create());
foreach ($childNodes as $childNode) {
if (!isset($outputNodeAggregateIds[$childNode->nodeAggregateId->value])) {
if (!isset($outputNodeAggregateIds[$childNode->aggregateId->value])) {
$output[] = $childNode;
$outputNodeAggregateIds[$childNode->nodeAggregateId->value] = true;
$outputNodeAggregateIds[$childNode->aggregateId->value] = true;
}
}
}
Expand Down Expand Up @@ -142,14 +142,14 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse
$resolvedNode = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findNodeByPath(
NodePath::fromString($nodePath),
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
);

if (!is_null($resolvedNode) && !isset($filteredOutputNodeIdentifiers[
$resolvedNode->nodeAggregateId->value
$resolvedNode->aggregateId->value
])) {
$filteredOutput[] = $resolvedNode;
$filteredOutputNodeIdentifiers[$resolvedNode->nodeAggregateId->value] = true;
$filteredOutputNodeIdentifiers[$resolvedNode->aggregateId->value] = true;
}
}
} elseif (count($instanceOfFilters) > 0) {
Expand All @@ -161,7 +161,7 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse
foreach ($flowQuery->getContext() as $contextNode) {
$childNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findChildNodes(
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
FindChildNodesFilter::create(
nodeTypes: NodeTypeCriteria::create(
NodeTypeNames::fromStringArray($allowedNodeTypes),
Expand All @@ -172,10 +172,10 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse

foreach ($childNodes as $childNode) {
if (!isset($filteredOutputNodeIdentifiers[
$childNode->nodeAggregateId->value
$childNode->aggregateId->value
])) {
$filteredOutput[] = $childNode;
$filteredOutputNodeIdentifiers[$childNode->nodeAggregateId->value] = true;
$filteredOutputNodeIdentifiers[$childNode->aggregateId->value] = true;
}
}
}
Expand All @@ -198,7 +198,7 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse
/** @var Node $filteredNode */
foreach ($filteredOutput as $filteredNode) {
/** @phpstan-ignore-next-line undefined behaviour https://github.com/neos/neos-development-collection/issues/4507#issuecomment-1784123143 */
if (!isset($outputNodeAggregateIds[$filteredNode->nodeAggregateId->value])) {
if (!isset($outputNodeAggregateIds[$filteredNode->aggregateId->value])) {
$output[] = $filteredNode;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)

foreach ($contextNodeQuery as $result) {
/* @var Node $result */
$output[$result->nodeAggregateId->value] = $result;
$output[$result->aggregateId->value] = $result;
}
}

Expand Down

0 comments on commit 008d9bf

Please sign in to comment.