Skip to content

Commit

Permalink
#220 The getChildren() function now always returns an array, and it u…
Browse files Browse the repository at this point in the history
…ses the children() function of the Doctrine Tree extension to return the direct children of a Collection instance
  • Loading branch information
extracts committed Feb 17, 2022
1 parent 9a4c35a commit f919371
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions library/Opus/Model2/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,17 @@ public function setParent($parent)
}

/**
* @return ORMCollection|self[]
* Returns all child nodes. Always returns an array, even if the result set has zero or one element.
*
* @return self[]
*/
public function getChildren()
{
return $this->children;
// TODO DOCTRINE The $this->children property is currently unused

$children = self::getRepository()->children($this, true, 'left');

return $children ?: [];
}

/**
Expand Down

0 comments on commit f919371

Please sign in to comment.