Skip to content

Commit

Permalink
TASK: Rename Node::$nodeAggregateId to Node::$aggregateId
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 18, 2024
1 parent b9de62d commit 28fb9c5
Show file tree
Hide file tree
Showing 27 changed files with 93 additions and 93 deletions.
10 changes: 5 additions & 5 deletions Classes/Application/ReloadNodes/ReloadNodesQueryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function handle(ReloadNodesQuery $query, ActionRequest $actionRequest): R
}

$ancestors = $subgraph->findAncestorNodes(
$documentNode->nodeAggregateId,
$documentNode->aggregateId,
FindAncestorNodesFilter::create(
NodeTypeCriteria::fromFilterString(NodeTypeNameFactory::NAME_DOCUMENT)
)
Expand All @@ -120,15 +120,15 @@ public function handle(ReloadNodesQuery $query, ActionRequest $actionRequest): R
if ($level < $this->loadingDepth || // load all nodes within loadingDepth
$this->loadingDepth === 0 || // unlimited loadingDepth
// load toggled nodes
$query->toggledNodesIds->contain($baseNode->nodeAggregateId) ||
$query->toggledNodesIds->contain($baseNode->aggregateId) ||
// load children of all parents of documentNode
in_array($baseNode->nodeAggregateId->value, array_map(
fn (Node $node): string => $node->nodeAggregateId->value,
in_array($baseNode->aggregateId->value, array_map(
fn (Node $node): string => $node->aggregateId->value,
iterator_to_array($ancestors)
))
) {
foreach ($subgraph->findChildNodes(
$baseNode->nodeAggregateId,
$baseNode->aggregateId,
FindChildNodesFilter::create(nodeTypes: $baseNodeTypeConstraints)
) as $childNode) {
$nodeMapBuilder->addNode($childNode);
Expand Down
2 changes: 1 addition & 1 deletion Classes/ContentRepository/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepo
$node = $subgraph->findNodeById($change->nodeAggregateId);

if ($node instanceof Node) {
$documentNode = $subgraph->findClosestNode($node->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
$documentNode = $subgraph->findClosestNode($node->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
if ($documentNode instanceof Node) {
$contentRepository = $this->contentRepositoryRegistry->get($documentNode->contentRepositoryId);
$nodeAddressFactory = NodeAddressFactory::create($contentRepository);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function indexAction(string $node = null)

$siteNode = $subgraph->findNodeByPath(
$siteDetectionResult->siteNodeName->toNodeName(),
$rootNode->nodeAggregateId
$rootNode->aggregateId
);

if (!$nodeAddress) {
Expand Down
6 changes: 3 additions & 3 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,17 +468,17 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d
// todo ensure that https://github.com/neos/neos-ui/pull/3734 doesnt need to be refixed in Neos 9.0
$redirectNode = $documentNode;
while (true) {
$redirectNodeInBaseWorkspace = $subgraph->findNodeById($redirectNode->nodeAggregateId);
$redirectNodeInBaseWorkspace = $subgraph->findNodeById($redirectNode->aggregateId);
if ($redirectNodeInBaseWorkspace) {
break;
} else {
$redirectNode = $subgraph->findParentNode($redirectNode->nodeAggregateId);
$redirectNode = $subgraph->findParentNode($redirectNode->aggregateId);
// get parent always returns Node
if (!$redirectNode) {
throw new \Exception(
sprintf(
'Wasn\'t able to locate any valid node in rootline of node %s in the workspace %s.',
$documentNode->nodeAggregateId->value,
$documentNode->aggregateId->value,
$targetWorkspaceName
),
1458814469
Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/AbstractChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function updateWorkspaceInfo(): void
{
if (!is_null($this->subject)) {
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($this->subject);
$documentNode = $subgraph->findClosestNode($this->subject->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
$documentNode = $subgraph->findClosestNode($this->subject->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
if (!is_null($documentNode)) {
$updateWorkspaceInfo = new UpdateWorkspaceInfo($documentNode->contentRepositoryId, $documentNode->workspaceName);
$this->feedbackCollection->add($updateWorkspaceInfo);
Expand All @@ -81,7 +81,7 @@ protected function updateWorkspaceInfo(): void
protected function findParentNode(Node $node): ?Node
{
return $this->contentRepositoryRegistry->subgraphForNode($node)
->findParentNode($node->nodeAggregateId);
->findParentNode($node->aggregateId);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Changes/AbstractCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected function createNode(
$nodeAggregateId,
$nodeTypeName,
OriginDimensionSpacePoint::fromDimensionSpacePoint($parentNode->dimensionSpacePoint),
$parentNode->nodeAggregateId,
$parentNode->aggregateId,
$succeedingSiblingNodeAggregateId,
$nodeName
);
Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/Changes/AbstractStructuralChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function finish(Node $node)
$this->feedbackCollection->add($updateNodeInfo);

$parentNode = $this->contentRepositoryRegistry->subgraphForNode($node)
->findParentNode($node->nodeAggregateId);
->findParentNode($node->aggregateId);
if ($parentNode) {
$updateParentNodeInfo = new UpdateNodeInfo();
$updateParentNodeInfo->setNode($parentNode);
Expand Down Expand Up @@ -184,7 +184,7 @@ protected function findChildNodes(Node $node): Nodes
{
// TODO REMOVE
return $this->contentRepositoryRegistry->subgraphForNode($node)
->findChildNodes($node->nodeAggregateId, FindChildNodesFilter::create());
->findChildNodes($node->aggregateId, FindChildNodesFilter::create());
}

protected function isNodeTypeAllowedAsChildNode(Node $parentNode, NodeTypeName $nodeTypeNameToCheck): bool
Expand Down
6 changes: 3 additions & 3 deletions Classes/Domain/Model/Changes/CopyAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ public function apply(): void
$subject->workspaceName,
$subject,
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint),
$parentNodeOfPreviousSibling->nodeAggregateId,
$succeedingSibling?->nodeAggregateId,
$parentNodeOfPreviousSibling->aggregateId,
$succeedingSibling?->aggregateId,
null
);

$contentRepository->handle($command)->block();

$newlyCreatedNode = $this->contentRepositoryRegistry->subgraphForNode($parentNodeOfPreviousSibling)
->findNodeById(
$command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->nodeAggregateId)
$command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->aggregateId)
);
$this->finish($newlyCreatedNode);
// NOTE: we need to run "finish" before "addNodeCreatedFeedback"
Expand Down
6 changes: 3 additions & 3 deletions Classes/Domain/Model/Changes/CopyBefore.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ public function apply(): void
$subject->workspaceName,
$subject,
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint),
$parentNodeOfSucceedingSibling->nodeAggregateId,
$succeedingSibling->nodeAggregateId,
$parentNodeOfSucceedingSibling->aggregateId,
$succeedingSibling->aggregateId,
null
);

$contentRepository->handle($command)->block();

$newlyCreatedNode = $this->contentRepositoryRegistry->subgraphForNode($parentNodeOfSucceedingSibling)
->findNodeById(
$command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->nodeAggregateId)
$command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->aggregateId)
);
$this->finish($newlyCreatedNode);
// NOTE: we need to run "finish" before "addNodeCreatedFeedback"
Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/Changes/CopyInto.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ public function apply(): void
$subject->workspaceName,
$subject,
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint),
$parentNode->nodeAggregateId,
$parentNode->aggregateId,
null,
null
);
$contentRepository->handle($command)->block();

$newlyCreatedNode = $this->contentRepositoryRegistry->subgraphForNode($parentNode)
->findNodeById(
$command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->nodeAggregateId),
$command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->aggregateId),
);
$this->finish($newlyCreatedNode);
// NOTE: we need to run "finish" before "addNodeCreatedFeedback"
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Changes/CreateAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function apply(): void
// do nothing; $succeedingSibling is null.
}

$this->createNode($parentNode, $succeedingSibling?->nodeAggregateId);
$this->createNode($parentNode, $succeedingSibling?->aggregateId);

$this->updateWorkspaceInfo();
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Changes/CreateBefore.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function apply(): void
$parent = $this->subject ? $this->findParentNode($this->subject) : null;
$subject = $this->subject;
if ($this->canApply() && !is_null($subject) && !is_null($parent)) {
$this->createNode($parent, $subject->nodeAggregateId);
$this->createNode($parent, $subject->aggregateId);
$this->updateWorkspaceInfo();
}
}
Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Model/Changes/MoveAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ public function apply(): void
// do nothing; $succeedingSibling is null.
}

$hasEqualParentNode = $parentNode->nodeAggregateId
->equals($parentNodeOfPreviousSibling->nodeAggregateId);
$hasEqualParentNode = $parentNode->aggregateId
->equals($parentNodeOfPreviousSibling->aggregateId);


$contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId);

$command = MoveNodeAggregate::create(
$subject->workspaceName,
$subject->dimensionSpacePoint,
$subject->nodeAggregateId,
$subject->aggregateId,
RelationDistributionStrategy::STRATEGY_GATHER_ALL,
$hasEqualParentNode ? null : $parentNodeOfPreviousSibling->nodeAggregateId,
$precedingSibling->nodeAggregateId,
$succeedingSibling?->nodeAggregateId,
$hasEqualParentNode ? null : $parentNodeOfPreviousSibling->aggregateId,
$precedingSibling->aggregateId,
$succeedingSibling?->aggregateId,
);
$contentRepository->handle($command)->block();

Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Model/Changes/MoveBefore.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ public function apply(): void
// do nothing; $precedingSibling is null.
}

$hasEqualParentNode = $parentNode->nodeAggregateId
->equals($succeedingSiblingParent->nodeAggregateId);
$hasEqualParentNode = $parentNode->aggregateId
->equals($succeedingSiblingParent->aggregateId);

$contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId);

$contentRepository->handle(
MoveNodeAggregate::create(
$subject->workspaceName,
$subject->dimensionSpacePoint,
$subject->nodeAggregateId,
$subject->aggregateId,
RelationDistributionStrategy::STRATEGY_GATHER_ALL,
$hasEqualParentNode
? null
: $succeedingSiblingParent->nodeAggregateId,
$precedingSibling?->nodeAggregateId,
$succeedingSibling->nodeAggregateId,
: $succeedingSiblingParent->aggregateId,
$precedingSibling?->aggregateId,
$succeedingSibling->aggregateId,
)
)->block();

Expand Down
10 changes: 5 additions & 5 deletions Classes/Domain/Model/Changes/MoveInto.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ public function apply(): void
$subject = $this->subject;
if ($this->canApply() && $parentNode && $subject) {
$otherParent = $this->contentRepositoryRegistry->subgraphForNode($subject)
->findParentNode($subject->nodeAggregateId);
->findParentNode($subject->aggregateId);

$hasEqualParentNode = $otherParent && $otherParent->nodeAggregateId
->equals($parentNode->nodeAggregateId);
$hasEqualParentNode = $otherParent && $otherParent->aggregateId
->equals($parentNode->aggregateId);

$contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId);
$contentRepository->handle(
MoveNodeAggregate::create(
$subject->workspaceName,
$subject->dimensionSpacePoint,
$subject->nodeAggregateId,
$subject->aggregateId,
RelationDistributionStrategy::STRATEGY_GATHER_ALL,
$hasEqualParentNode ? null : $parentNode->nodeAggregateId,
$hasEqualParentNode ? null : $parentNode->aggregateId,
)
)->block();

Expand Down
16 changes: 8 additions & 8 deletions Classes/Domain/Model/Changes/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function createFeedback(Node $subject): void
// These 'Change' classes have been designed with mutable Neos < 9 Nodes and thus this might seem hacky
// When fully redesigning the Neos Ui php integration this will fixed
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($subject);
$originalNodeAggregateId = $subject->nodeAggregateId;
$originalNodeAggregateId = $subject->aggregateId;
$node = $subgraph->findNodeById($originalNodeAggregateId);
if (is_null($node)) {
throw new \InvalidArgumentException(
Expand All @@ -186,7 +186,7 @@ private function createFeedback(Node $subject): void
}

$this->updateWorkspaceInfo();
$parentNode = $subgraph->findParentNode($node->nodeAggregateId);
$parentNode = $subgraph->findParentNode($node->aggregateId);

// This might be needed to update node label and other things that we can calculate only on the server
$updateNodeInfo = new UpdateNodeInfo();
Expand Down Expand Up @@ -240,7 +240,7 @@ private function handleNodeReferenceChange(Node $subject, string $propertyName):
$contentRepository->handle(
SetNodeReferences::create(
$subject->workspaceName,
$subject->nodeAggregateId,
$subject->aggregateId,
$subject->originDimensionSpacePoint,
ReferenceName::fromString($propertyName),
NodeReferencesToWrite::fromNodeAggregateIds(NodeAggregateIds::fromArray($destinationNodeAggregateIds))
Expand All @@ -259,15 +259,15 @@ private function handleHiddenPropertyChange(Node $subject, string $propertyName)

$command = EnableNodeAggregate::create(
$subject->workspaceName,
$subject->nodeAggregateId,
$subject->aggregateId,
$subject->originDimensionSpacePoint->toDimensionSpacePoint(),
NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS
);

if ($value === true) {
$command = DisableNodeAggregate::create(
$subject->workspaceName,
$subject->nodeAggregateId,
$subject->aggregateId,
$subject->originDimensionSpacePoint->toDimensionSpacePoint(),
NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS
);
Expand All @@ -287,7 +287,7 @@ private function handleNodeTypeChange(Node $subject, string $propertyName): void
$contentRepository->handle(
ChangeNodeAggregateType::create(
$subject->workspaceName,
$subject->nodeAggregateId,
$subject->aggregateId,
NodeTypeName::fromString($value),
NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy::STRATEGY_DELETE
)
Expand All @@ -309,7 +309,7 @@ private function handlePropertyChange(Node $subject, string $propertyName): void
$contentRepository->handle(
CreateNodeVariant::create(
$subject->workspaceName,
$subject->nodeAggregateId,
$subject->aggregateId,
$subject->originDimensionSpacePoint,
$originDimensionSpacePoint
)
Expand All @@ -319,7 +319,7 @@ private function handlePropertyChange(Node $subject, string $propertyName): void
$contentRepository->handle(
SetNodeProperties::create(
$subject->workspaceName,
$subject->nodeAggregateId,
$subject->aggregateId,
$originDimensionSpacePoint,
PropertyValuesToWrite::fromArray(
[
Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Model/Changes/Remove.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function apply(): void
$parentNode = $this->findParentNode($subject);
if (is_null($parentNode)) {
throw new \InvalidArgumentException(
'Cannot apply Remove without a parent on node ' . $subject->nodeAggregateId->value,
'Cannot apply Remove without a parent on node ' . $subject->aggregateId->value,
1645560717
);
}
Expand All @@ -75,7 +75,7 @@ public function apply(): void

$command = RemoveNodeAggregate::create(
$subject->workspaceName,
$subject->nodeAggregateId,
$subject->aggregateId,
$subject->dimensionSpacePoint,
NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS,
);
Expand All @@ -102,11 +102,11 @@ private function getRemovalAttachmentPoint(): ?NodeAggregateId
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($this->subject);

if ($this->subject->nodeType?->isOfType(NodeTypeNameFactory::NAME_DOCUMENT)) {
$closestSiteNode = $subgraph->findClosestNode($this->subject->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_SITE));
return $closestSiteNode?->nodeAggregateId;
$closestSiteNode = $subgraph->findClosestNode($this->subject->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_SITE));
return $closestSiteNode?->aggregateId;
}

$closestDocumentParentNode = $subgraph->findClosestNode($this->subject->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
return $closestDocumentParentNode?->nodeAggregateId;
$closestDocumentParentNode = $subgraph->findClosestNode($this->subject->aggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
return $closestDocumentParentNode?->aggregateId;
}
}
Loading

0 comments on commit 28fb9c5

Please sign in to comment.