diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2010-01-08 11:49:01 -0800 | 
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-08 11:49:01 -0800 | 
| commit | 3fc6dab7acf8d6bacbc557a8554f92d251c0ed6b (patch) | |
| tree | 6dd37138fc0830488aacd59b05708dea1eae3bd8 /modules/gallery/libraries | |
| parent | 2d8843ba4d780b8a9c3662f78d17ca29ebb1c8df (diff) | |
Expect merge_where and merge_or_where to handle empty tuples.
Diffstat (limited to 'modules/gallery/libraries')
| -rw-r--r-- | modules/gallery/libraries/ORM_MPTT.php | 20 | 
1 files changed, 4 insertions, 16 deletions
| diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php index 0ea519c9..c660b119 100644 --- a/modules/gallery/libraries/ORM_MPTT.php +++ b/modules/gallery/libraries/ORM_MPTT.php @@ -165,11 +165,8 @@ class ORM_MPTT_Core extends ORM {     * @return array ORM     */    function children($limit=null, $offset=null, $where=null, $order_by=array("id" => "ASC")) { -    if ($where) { -      $this->merge_where($where); -    } -      return $this +      ->merge_where($where)        ->where("parent_id", "=", $this->id)        ->order_by($order_by)        ->find_all($limit, $offset); @@ -183,11 +180,8 @@ class ORM_MPTT_Core extends ORM {     * @return array ORM     */    function children_count($where=null) { -    if ($where) { -      $this->merge_where($where); -    } -      return $this +      ->merge_where($where)        ->where("parent_id", "=", $this->id)        ->count_all();    } @@ -202,11 +196,8 @@ class ORM_MPTT_Core extends ORM {     * @return object ORM_Iterator     */    function descendants($limit=null, $offset=null, $where=null, $order_by=array("id" => "ASC")) { -    if ($where) { -      $this->merge_where($where); -    } -      return $this +      ->merge_where($where);        ->where("left_ptr", ">", $this->left_ptr)        ->where("right_ptr", "<=", $this->right_ptr)        ->order_by($order_by) @@ -220,11 +211,8 @@ class ORM_MPTT_Core extends ORM {     * @return   integer  child count     */    function descendants_count($where=null) { -    if ($where) { -      $this->merge_where($where); -    } -      return $this +      ->merge_where($where);        ->where("left_ptr", ">", $this->left_ptr)        ->where("right_ptr", "<=", $this->right_ptr)        ->count_all(); | 
