Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Remove references to deprecate node read model properties #5066

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -282,14 +282,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 @@ -273,13 +273,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 @@ -295,13 +295,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 @@ -310,9 +310,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 @@ -323,7 +323,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 @@ -188,7 +188,7 @@ private function handleChangeNodeAggregateType(
VisibilityConstraints::withoutRestrictions()
)->findNodeByPath(
$tetheredNodeTypeDefinition->name,
$node->nodeAggregateId,
$node->aggregateId,
);

if ($tetheredNode === null) {
Expand Down Expand Up @@ -404,7 +404,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}.
mhsdesign marked this conversation as resolved.
Show resolved Hide resolved
*
* 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
Loading
Loading