Skip to content

Commit

Permalink
TASK: Fix flowqueries to use new aggregateId
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jul 3, 2024
1 parent 157ebc6 commit 8d9a01f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
}

$output = [];
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$contextNodeQuery = new FlowQuery([$contextNode]);
$contextNodeQuery->pushOperation('first', []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
$output = [];
$outputNodePaths = [];
foreach ($flowQuery->getContext() as $contextNode) {
/** @var Node $contextNode */
$nextNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findSucceedingSiblingNodes(
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
FindSucceedingSiblingNodesFilter::create()
);
foreach ($nextNodes as $nextNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
$output = [];
$outputNodePaths = [];
foreach ($flowQuery->getContext() as $contextNode) {
/** @var Node $contextNode */
$nextNode = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findSucceedingSiblingNodes(
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
FindSucceedingSiblingNodesFilter::create()
)->first();
if ($nextNode !== null && !isset($outputNodePaths[$nextNode->aggregateId->value])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
$outputNodeIdentifiers = [];

foreach ($flowQuery->getContext() as $contextNode) {
/** @var Node $contextNode */
$nextNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findSucceedingSiblingNodes(
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
FindSucceedingSiblingNodesFilter::create()
);
if (isset($arguments[0]) && !empty($arguments[0])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$output = [];
$outputNodeAggregateIds = [];
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
/* @var $contextNode Node */
$parentNode = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findParentNode($contextNode->aggregateId);
if ($parentNode === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
NodeTypeNames::with(NodeTypeNameFactory::forRoot())
)
);
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$parentNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findAncestorNodes($contextNode->nodeAggregateId, $findAncestorNodesFilter);
->findAncestorNodes($contextNode->aggregateId, $findAncestorNodesFilter);
if (isset($arguments[0]) && !empty($arguments[0] && !$parentNodes->isEmpty())) {
$filterQuery = new FlowQuery(iterator_to_array($parentNodes));
$filterQuery->pushOperation('filter', [$arguments[0]]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$output = [];
$outputNodeAggregateIds = [];
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$prevNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findPrecedingSiblingNodes(
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
FindPrecedingSiblingNodesFilter::create()
)->reverse();
foreach ($prevNodes as $prevNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void
{
$output = [];
$outputNodePaths = [];
/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$previousNode = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findPrecedingSiblingNodes(
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
FindPrecedingSiblingNodesFilter::create()
)->first();
if ($previousNode !== null && !isset($outputNodePaths[$previousNode->aggregateId->value])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void
$output = [];
$outputNodeIdentifiers = [];

/** @var Node $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
$prevNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode)
->findPrecedingSiblingNodes(
$contextNode->nodeAggregateId,
$contextNode->aggregateId,
FindPrecedingSiblingNodesFilter::create()
);
if (isset($arguments[0]) && !empty($arguments[0])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void
}

foreach ($flowQuery->getContext() as $contextNode) {
/** @var Node $contextNode */
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($contextNode);

$parentNode = $subgraph->findParentNode($contextNode->aggregateId);
Expand Down

0 comments on commit 8d9a01f

Please sign in to comment.