From d3599de14ac0e7a791a611f0435a17495c3a0f5b Mon Sep 17 00:00:00 2001 From: guilhermeblanco Date: Thu, 1 Oct 2009 20:28:53 +0000 Subject: [PATCH] [2.0][DDC-23] Implemented setFirstResult, getFirstResult aswell as setMaxResults and getMaxResults in QueryBuilder --- lib/Doctrine/ORM/QueryBuilder.php | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/lib/Doctrine/ORM/QueryBuilder.php b/lib/Doctrine/ORM/QueryBuilder.php index 51b356f13..b6c029864 100644 --- a/lib/Doctrine/ORM/QueryBuilder.php +++ b/lib/Doctrine/ORM/QueryBuilder.php @@ -297,6 +297,52 @@ class QueryBuilder { return $this->_q->getParameter($key); } + + /** + * Sets the position of the first result to retrieve (the "offset"). + * + * @param integer $firstResult The first result to return. + * @return QueryBuilder This query builder object. + */ + public function setFirstResult($firstResult) + { + $this->_q->setFirstResult($firstResult); + return $this; + } + + /** + * Gets the position of the first result the query object was set to retrieve (the "offset"). + * Returns NULL if {@link setFirstResult} was not applied to this query builder. + * + * @return integer The position of the first result. + */ + public function getFirstResult() + { + return $this->_q->getFirstResult(); + } + + /** + * Sets the maximum number of results to retrieve (the "limit"). + * + * @param integer $maxResults + * @return QueryBuilder This query builder object. + */ + public function setMaxResults($maxResults) + { + $this->_q->setMaxResults($maxResults); + return $this; + } + + /** + * Gets the maximum number of results the query object was set to retrieve (the "limit"). + * Returns NULL if {@link setMaxResults} was not applied to this query builder. + * + * @return integer Maximum number of results. + */ + public function getMaxResults() + { + return $this->_q->getMaxResults(); + } /** * Add a single DQL query part to the array of parts