Permalink
Browse files

The default value for $offset should always be null (according to the

new K24 ORM).

Fix up a bad where tuple in the test.
  • Loading branch information...
1 parent 71e154b commit a6da027aad5072a85719fc9e201ee946963e74f0 @bharat bharat committed Dec 23, 2009
@@ -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);
}
@@ -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
@@ -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() {

0 comments on commit a6da027

Please sign in to comment.