Skip to content

Commit

Permalink
TASK: Task rename alias in ancestor queries
Browse files Browse the repository at this point in the history
`cn` should actually be named `ch` as it's joined as the child hierarchy relation
  • Loading branch information
mhsdesign committed Nov 4, 2024
1 parent ed605bd commit 2dbd3a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* - cn -> child node
* - h -> the hierarchy edge connecting parent and child
* - ph -> the hierarchy edge incoming to the parent (sometimes relevant)
* - ch -> the hierarchy edge of the child (sometimes relevant)
* - dsp -> dimension space point, resolves hashes to full dimension coordinates
* - cdsp -> child dimension space point, same as dsp for child queries
* - pdsp -> parent dimension space point, same as dsp for parent queries
Expand Down Expand Up @@ -199,11 +200,11 @@ public function findAncestorNodeAggregateIds(NodeAggregateId $entryNodeAggregate
->andWhere('c.nodeaggregateid = :entryNodeAggregateId');

$queryBuilderRecursive = $this->createQueryBuilder()
->select('pn.nodeAggregateId, h.parentnodeanchor')
->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')
->where('h.contentstreamid = :contentStreamId');
->select('pn.nodeAggregateId, ph.parentnodeanchor')
->from('ancestry', 'ch')
->innerJoin('ch', $this->nodeQueryBuilder->tableNames->node(), 'pn', 'pn.relationanchorpoint = ch.parentnodeanchor')
->innerJoin('pn', $this->nodeQueryBuilder->tableNames->hierarchyRelation(), 'ph', 'ph.childnodeanchor = pn.relationanchorpoint')
->where('ph.contentstreamid = :contentStreamId');

$queryBuilderCte = $this->createQueryBuilder()
->select('pn.nodeAggregateId')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
* - cn -> child node
* - h -> the hierarchy edge connecting parent and child
* - ph -> the hierarchy edge incoming to the parent (sometimes relevant)
* - ch -> the hierarchy edge of the child (sometimes relevant)
*
* - if more than one node (source-destination)
* - sn -> source node
Expand Down Expand Up @@ -570,8 +571,8 @@ private function buildAncestorNodesQueries(NodeAggregateId $entryNodeAggregateId

$queryBuilderRecursive = $this->createQueryBuilder()
->select('pn.*, h.subtreetags, h.parentnodeanchor')
->from('ancestry', 'cn')
->innerJoin('cn', $this->nodeQueryBuilder->tableNames->node(), 'pn', 'pn.relationanchorpoint = cn.parentnodeanchor')
->from('ancestry', 'ch')
->innerJoin('ch', $this->nodeQueryBuilder->tableNames->node(), 'pn', 'pn.relationanchorpoint = ch.parentnodeanchor')
->innerJoin('pn', $this->nodeQueryBuilder->tableNames->hierarchyRelation(), 'h', 'h.childnodeanchor = pn.relationanchorpoint')
->where('h.contentstreamid = :contentStreamId')
->andWhere('h.dimensionspacepointhash = :dimensionSpacePointHash');
Expand Down

0 comments on commit 2dbd3a0

Please sign in to comment.