Skip to content

Commit 4dc74dc

Browse files
authored
Merge pull request #3992 from neos/bugfix/speedup-copy-node-by-removing-recursive-node-fetching-in-response
BUGFIX: Speed up node tree copy actions 9.0 port of #3984
2 parents 30d5a09 + df830b8 commit 4dc74dc

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

Classes/Domain/Model/Changes/AbstractStructuralChange.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ protected function finish(Node $node)
125125
{
126126
$updateNodeInfo = new UpdateNodeInfo();
127127
$updateNodeInfo->setNode($node);
128-
$updateNodeInfo->recursive();
129128
$this->feedbackCollection->add($updateNodeInfo);
130129

131130
$parentNode = $this->contentRepositoryRegistry->subgraphForNode($node)

Classes/Domain/Model/Feedback/Operations/UpdateNodeInfo.php

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class UpdateNodeInfo extends AbstractFeedback
4141
*/
4242
protected $contentRepositoryRegistry;
4343

44-
protected bool $isRecursive = false;
45-
4644
protected ?string $baseNodeType = null;
4745

4846
public function setBaseNodeType(?string $baseNodeType): void
@@ -60,14 +58,6 @@ public function setNode(Node $node): void
6058
$this->node = $node;
6159
}
6260

63-
/**
64-
* Update node infos recursively
65-
*/
66-
public function recursive(): void
67-
{
68-
$this->isRecursive = true;
69-
}
70-
7161
public function getNode(): Node
7262
{
7363
return $this->node;
@@ -103,7 +93,7 @@ public function isSimilarTo(FeedbackInterface $feedback): bool
10393
public function serializePayload(ControllerContext $controllerContext): array
10494
{
10595
return [
106-
'byContextPath' => $this->serializeNodeRecursively($this->node, $controllerContext->getRequest())
96+
'byContextPath' => $this->serializeNode($this->node, $controllerContext->getRequest())
10797
];
10898
}
10999

@@ -112,25 +102,13 @@ public function serializePayload(ControllerContext $controllerContext): array
112102
*
113103
* @return array<string,?array<string,mixed>>
114104
*/
115-
private function serializeNodeRecursively(Node $node, ActionRequest $actionRequest): array
105+
private function serializeNode(Node $node, ActionRequest $actionRequest): array
116106
{
117-
$contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
118-
119-
$result = [
120-
NodeAddress::fromNode($node)->toJson()
121-
=> $this->nodeInfoHelper->renderNodeWithPropertiesAndChildrenInformation(
107+
return [
108+
NodeAddress::fromNode($node)->toJson() => $this->nodeInfoHelper->renderNodeWithPropertiesAndChildrenInformation(
122109
$node,
123110
$actionRequest
124111
)
125112
];
126-
127-
if ($this->isRecursive === true) {
128-
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
129-
foreach ($subgraph->findChildNodes($node->aggregateId, FindChildNodesFilter::create()) as $childNode) {
130-
$result = array_merge($result, $this->serializeNodeRecursively($childNode, $actionRequest));
131-
}
132-
}
133-
134-
return $result;
135113
}
136114
}

0 commit comments

Comments
 (0)