1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Update lib/Doctrine/ORM/Tools/Pagination/Paginator.php

Replaced the foreach loop adding all IDs as single parameters with a single parameter which injects the IDs as an array.
This commit is contained in:
HarmenM 2012-10-12 14:23:41 +03:00 committed by Benjamin Eberlei
parent 88d0933a6e
commit 8a29d91d15

View File

@ -179,15 +179,10 @@ class Paginator implements \Countable, \IteratorAggregate
return new \ArrayIterator(array()); return new \ArrayIterator(array());
} }
$namespace = WhereInWalker::PAGINATOR_ID_ALIAS;
$whereInQuery->setHint(Query::HINT_CUSTOM_TREE_WALKERS, array('Doctrine\ORM\Tools\Pagination\WhereInWalker')); $whereInQuery->setHint(Query::HINT_CUSTOM_TREE_WALKERS, array('Doctrine\ORM\Tools\Pagination\WhereInWalker'));
$whereInQuery->setHint(WhereInWalker::HINT_PAGINATOR_ID_COUNT, count($ids)); $whereInQuery->setHint(WhereInWalker::HINT_PAGINATOR_ID_COUNT, count($ids));
$whereInQuery->setFirstResult(null)->setMaxResults(null); $whereInQuery->setFirstResult(null)->setMaxResults(null);
foreach ($ids as $i => $id) { $whereInQuery->setParameter(WhereInWalker::PAGINATOR_ID_ALIAS, $ids);
$i++;
$whereInQuery->setParameter("{$namespace}_{$i}", $id);
}
$result = $whereInQuery->getResult($this->query->getHydrationMode()); $result = $whereInQuery->getResult($this->query->getHydrationMode());
} else { } else {