Skip to content

Commit f749c76

Browse files
larowlankimpepper
authored andcommitted
Find children should order (#8)
* Find children should order * Add table prefix
1 parent 19870ca commit f749c76

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/Storage/DbalNestedSet.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public function findDescendants(Node $node, $depth = 0) {
137137
->andWhere('parent.revision_id = :revision_id')
138138
->andwhere('child.left_pos > parent.left_pos')
139139
->andWhere('child.right_pos < parent.right_pos')
140+
->orderBy('child.left_pos', 'ASC')
140141
->setParameter(':id', $node->getId())
141142
->setParameter(':revision_id', $node->getRevisionId());
142143
if ($depth > 0) {

tests/Functional/DbalNestedSetTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,14 +482,6 @@ protected function loadTestData() {
482482
'right_pos' => 7,
483483
'depth' => 3,
484484
]);
485-
$this->connection->insert($this->tableName,
486-
[
487-
'id' => 7,
488-
'revision_id' => 1,
489-
'left_pos' => 11,
490-
'right_pos' => 16,
491-
'depth' => 2,
492-
]);
493485
$this->connection->insert($this->tableName,
494486
[
495487
'id' => 8,
@@ -506,6 +498,14 @@ protected function loadTestData() {
506498
'right_pos' => 20,
507499
'depth' => 2,
508500
]);
501+
$this->connection->insert($this->tableName,
502+
[
503+
'id' => 7,
504+
'revision_id' => 1,
505+
'left_pos' => 11,
506+
'right_pos' => 16,
507+
'depth' => 2,
508+
]);
509509
$this->connection->insert($this->tableName,
510510
[
511511
'id' => 10,

0 commit comments

Comments
 (0)