From dfc5b0e60784954e03e38d1268fb256725497e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Sun, 20 Oct 2013 23:54:45 +0200 Subject: [PATCH] Allow change the hydratation mode on ResultSet --- src/Kdyby/Doctrine/ResultSet.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Kdyby/Doctrine/ResultSet.php b/src/Kdyby/Doctrine/ResultSet.php index da59157b..229b3742 100644 --- a/src/Kdyby/Doctrine/ResultSet.php +++ b/src/Kdyby/Doctrine/ResultSet.php @@ -152,12 +152,15 @@ public function getTotalCount() /** - * @throws \Kdyby\Doctrine\QueryException + * @param int $hydrationMode + * @throws QueryException * @return \ArrayIterator */ - public function getIterator() + public function getIterator($hydrationMode = ORM\AbstractQuery::HYDRATE_OBJECT) { try { + $this->query->setHydrationMode($hydrationMode); + if ($this->query->getMaxResults() > 0 || $this->query->getFirstResult() > 0) { return $this->getPaginatedQuery()->getIterator(); }