Skip to content

Commit

Permalink
WIP position ordering for sibling in findAncestorNodeAggregateIds
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Sep 25, 2024
1 parent 16c0b30 commit 3cdf712
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function findParentNodeAggregates(
public function findAncestorNodeAggregateIds(NodeAggregateId $entryNodeAggregateId): NodeAggregateIds
{
$queryBuilderInitial = $this->createQueryBuilder()
->select('n.nodeAggregateId, ph.parentnodeanchor')
->select('n.nodeAggregateId, ph.parentnodeanchor, ph.position')
->from($this->nodeQueryBuilder->tableNames->node(), 'n')
// we need to join with the hierarchy relation, because we need the node name.
->innerJoin('n', $this->nodeQueryBuilder->tableNames->hierarchyRelation(), 'ch', 'ch.parentnodeanchor = n.relationanchorpoint')
Expand All @@ -203,7 +203,7 @@ public function findAncestorNodeAggregateIds(NodeAggregateId $entryNodeAggregate
->andWhere('c.nodeaggregateid = :entryNodeAggregateId');

$queryBuilderRecursive = $this->createQueryBuilder()
->select('pn.nodeAggregateId, h.parentnodeanchor')
->select('pn.nodeAggregateId, h.parentnodeanchor, h.position')
->from('ancestry', 'cn')
->innerJoin('cn', $this->nodeQueryBuilder->tableNames->node(), 'pn', 'pn.relationanchorpoint = cn.parentnodeanchor')
->innerJoin('pn', $this->nodeQueryBuilder->tableNames->hierarchyRelation(), 'h', 'h.childnodeanchor = pn.relationanchorpoint')
Expand All @@ -212,6 +212,7 @@ public function findAncestorNodeAggregateIds(NodeAggregateId $entryNodeAggregate
$queryBuilderCte = $this->createQueryBuilder()
->select('pn.nodeAggregateId')
->orderBy('pn.parentnodeanchor', 'DESC')
->addOrderBy('pn.position', 'DESC')
->from('ancestry', 'pn')
->setParameter('contentStreamId', $this->contentStreamId->value)
->setParameter('entryNodeAggregateId', $entryNodeAggregateId->value);
Expand Down

0 comments on commit 3cdf712

Please sign in to comment.