Skip to content

Commit

Permalink
Revert "Update QuerySubscriber.php"
Browse files Browse the repository at this point in the history
This reverts commit 8ac041f.
  • Loading branch information
docteurklein committed Jan 9, 2014
1 parent ae454fb commit 8803fda
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,21 @@ public function items(ItemsEvent $event)
if ($event->target instanceof Query) {
// process count
$useDoctrineWalkers = false;
if (version_compare(\Doctrine\ORM\Version::VERSION, '2.2.0', '>=')) {
$useDoctrineOutputWalker = false;
if (version_compare(\Doctrine\ORM\Version::VERSION, '2.3.0', '>=')) {
$useDoctrineWalkers = true;
$useDoctrineOutputWalker = true;
} else if (version_compare(\Doctrine\ORM\Version::VERSION, '2.2.0', '>=')) {
$useDoctrineWalkers = true;
}
if (($count = $event->target->getHint(self::HINT_COUNT)) !== false) {
$event->count = intval($count);
} else {
$countQuery = QueryHelper::cloneQuery($event->target);
if ($useDoctrineWalkers) {
if ($useDoctrineOutputWalker) {
$treeWalker = 'Doctrine\ORM\Tools\Pagination\CountOutputWalker';
$countQuery->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, $treeWalker);
} else if ($useDoctrineWalkers) {
QueryHelper::addCustomTreeWalker($countQuery, 'Doctrine\ORM\Tools\Pagination\CountWalker');
} else {
$treeWalker = 'Knp\Component\Pager\Event\Subscriber\Paginate\Doctrine\ORM\Query\CountWalker';
Expand Down

0 comments on commit 8803fda

Please sign in to comment.