Skip to content

Commit

Permalink
Added option to make the paginator return an array result in place of…
Browse files Browse the repository at this point in the history
… an object result
  • Loading branch information
MitMaro committed Oct 27, 2010
1 parent f569fe0 commit 412f11f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/DoctrineExtensions/Paginate/PaginationAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class PaginationAdapter implements \Zend_Paginator_Adapter_Interface
*/
protected $rowCount = null;

/**
* Use Array Result
*
* @var boolean
*/
protected $arrayResult = false;

/**
* Namespace to use for bound parameters
* If you use :pgid_# as a parameter, then
Expand All @@ -67,6 +74,16 @@ public function __construct(Query $query, $ns = 'pgid')
$this->namespace = $ns;
}

/**
* Set use array result flag
*
* @param boolean $flag True to use array result
*/
public function useArrayResult($flag = true)
{
$this->arrayResult = $flag;
}

/**
* Sets the total row count for this paginator
*
Expand Down Expand Up @@ -119,7 +136,11 @@ function ($e) { return current($e); },
$ids
);

return $this->createWhereInQuery($ids)->getResult();
if ($this->arrayResult) {
return $this->createWhereInQuery($ids)->getArrayResult();
} else {
return $this->createWhereInQuery($ids)->getResult();
}
}

/**
Expand Down

0 comments on commit 412f11f

Please sign in to comment.