vendor/knplabs/knp-components/src/Knp/Component/Pager/Event/Subscriber/Paginate/Doctrine/ODM/MongoDB/QueryBuilderSubscriber.php line 11

Open in your IDE?
  1. <?php
  2. namespace Knp\Component\Pager\Event\Subscriber\Paginate\Doctrine\ODM\MongoDB;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Knp\Component\Pager\Event\ItemsEvent;
  5. use Doctrine\ODM\MongoDB\Query\Builder;
  6. class QueryBuilderSubscriber implements EventSubscriberInterface
  7. {
  8.     public function items(ItemsEvent $event)
  9.     {
  10.         if ($event->target instanceof Builder) {
  11.             // change target into query
  12.             $event->target $event->target->getQuery();
  13.         }
  14.     }
  15.     public static function getSubscribedEvents()
  16.     {
  17.         return array(
  18.             'knp_pager.items' => array('items'10/*make sure to transform before any further modifications*/)
  19.         );
  20.     }
  21. }