Skip to content

Commit a9b14b2

Browse files
committed
TASK: Query nodes for UI flowqueries directly from the db
This way we only need one query to get all requested nodes instead of a query for each one.
1 parent c7637e8 commit a9b14b2

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

Classes/ContentRepository/Service/NodeService.php

+22
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
* source code.
1212
*/
1313

14+
use Doctrine\ORM\EntityManagerInterface;
15+
use Neos\ContentRepository\Domain\Factory\NodeFactory;
16+
use Neos\ContentRepository\Domain\Model\NodeData;
1417
use Neos\ContentRepository\Domain\Model\NodeInterface;
1518
use Neos\ContentRepository\Domain\Model\Workspace;
19+
use Neos\ContentRepository\Domain\Repository\NodeDataRepository;
1620
use Neos\ContentRepository\Domain\Service\Context;
1721
use Neos\ContentRepository\Domain\Service\ContextFactoryInterface;
1822
use Neos\ContentRepository\Domain\Utility\NodePaths;
@@ -47,6 +51,24 @@ class NodeService
4751
*/
4852
protected $domainRepository;
4953

54+
/**
55+
* @Flow\Inject
56+
* @var NodeDataRepository
57+
*/
58+
protected $nodeDataRepository;
59+
60+
/**
61+
* @Flow\Inject
62+
* @var EntityManagerInterface
63+
*/
64+
protected $entityManager;
65+
66+
/**
67+
* @Flow\Inject
68+
* @var NodeFactory
69+
*/
70+
protected $nodeFactory;
71+
5072
/**
5173
* @var array<string, Context>
5274
*/

Classes/Controller/BackendServiceController.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,9 @@ public function flowQueryAction(array $chain): string
533533
$finisher = array_pop($chain);
534534

535535
$nodeContextPaths = array_unique(array_column($createContext['payload'], '$node'));
536+
$nodes = $this->nodeService->getNodesFromContextPaths($nodeContextPaths);
536537

537-
$flowQuery = new FlowQuery(array_map(
538-
function ($contextPath) {
539-
return $this->nodeService->getNodeFromContextPath($contextPath);
540-
},
541-
$nodeContextPaths
542-
));
538+
$flowQuery = new FlowQuery($nodes);
543539

544540
foreach ($chain as $operation) {
545541
$flowQuery = call_user_func_array([$flowQuery, $operation['type']], $operation['payload']);

0 commit comments

Comments
 (0)