Skip to content

Commit

Permalink
The default value for $offset should always be null (according to the
Browse files Browse the repository at this point in the history
new K24 ORM).

Fix up a bad where tuple in the test.
  • Loading branch information
bharat committed Dec 23, 2009
1 parent 71e154b commit a6da027
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/gallery/libraries/ORM_MPTT.php
Expand Up @@ -201,7 +201,7 @@ function children_count($where=null) {
* @param array order_by
* @return object ORM_Iterator
*/
function descendants($limit=null, $offset=0, $where=null, $order_by=array("id" => "ASC")) {
function descendants($limit=null, $offset=null, $where=null, $order_by=array("id" => "ASC")) {
if ($where) {
$this->merge_where($where);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/models/item.php
Expand Up @@ -634,7 +634,7 @@ function children($limit=null, $offset=null, $where=array(), $order_by=null) {
* @param array additional where clauses
* @return object ORM_Iterator
*/
function descendants($limit=null, $offset=0, $where=array(), $order_by=null) {
function descendants($limit=null, $offset=null, $where=array(), $order_by=null) {
if (empty($order_by)) {
$order_by = array($this->sort_column => $this->sort_order);
// Use id as a tie breaker
Expand Down
4 changes: 2 additions & 2 deletions modules/gallery/tests/ORM_MPTT_Test.php
Expand Up @@ -190,8 +190,8 @@ public function descendant_test() {
$parent->reload();

$this->assert_equal(3, $parent->descendants()->count());
$this->assert_equal(2, $parent->descendants(null, 0, array("type" => "photo"))->count());
$this->assert_equal(1, $parent->descendants(null, 0, array("type" => "album"))->count());
$this->assert_equal(2, $parent->descendants(null, null, array(array("type", "=", "photo")))->count());
$this->assert_equal(1, $parent->descendants(null, null, array(array("type", "=", "album")))->count());
}

public function descendant_limit_test() {
Expand Down

0 comments on commit a6da027

Please sign in to comment.