Browse files

Added option to make the paginator return an array result in place of…

… an object result
  • Loading branch information...
1 parent f569fe0 commit 412f11f4538d89f7d76ba4bc3eecba2070deb4f4 @MitMaro MitMaro committed Oct 27, 2010
Showing with 22 additions and 1 deletion.
  1. +22 −1 lib/DoctrineExtensions/Paginate/PaginationAdapter.php
View
23 lib/DoctrineExtensions/Paginate/PaginationAdapter.php
@@ -47,6 +47,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
* you must change this.
@@ -68,6 +75,16 @@ public function __construct(Query $query, $ns = 'pgid')
}
/**
+ * 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
*
* Can be either an integer, or a Doctrine\ORM\Query object
@@ -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();
+ }
}
/**

0 comments on commit 412f11f

Please sign in to comment.