Skip to content

Commit e8af4ce

Browse files
committed
Made default order applied for querying descendants and siblings
1 parent 0949787 commit e8af4ce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Kalnoy/Nestedset/Node.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ public function siblings($dir = null)
428428

429429
default:
430430
$query = $this->newQuery()
431+
->defaultOrder()
431432
->where($this->getKeyName(), '<>', $this->getKey());
432433

433434
break;
@@ -947,7 +948,7 @@ public function getPrev(array $columns = array('*'))
947948
*/
948949
public function getAncestors(array $columns = array('*'))
949950
{
950-
return $this->newQuery()->ancestorsOf($this->getKey(), $columns);
951+
return $this->newQuery()->defaultOrder()->ancestorsOf($this->getKey(), $columns);
951952
}
952953

953954
/**
@@ -959,7 +960,7 @@ public function getAncestors(array $columns = array('*'))
959960
*/
960961
public function getDescendants(array $columns = array('*'))
961962
{
962-
return $this->newQuery()->descendantsOf($this->getKey(), $columns);
963+
return $this->newQuery()->defaultOrder()->descendantsOf($this->getKey(), $columns);
963964
}
964965

965966
/**
@@ -971,7 +972,7 @@ public function getDescendants(array $columns = array('*'))
971972
*/
972973
public function getSiblings(array $columns = array('*'))
973974
{
974-
return $this->siblings()->get($columns);
975+
return $this->siblings()->defaultOrder()->get($columns);
975976
}
976977

977978
/**

0 commit comments

Comments
 (0)