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

Open in your IDE?
  1. <?php
  2. namespace Knp\Component\Pager\Event\Subscriber\Paginate\Doctrine\ODM\PHPCR;
  3. use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder;
  4. use Knp\Component\Pager\Event\ItemsEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. /**
  7.  * @author Martin Hasoň <martin.hason@gmail.com>
  8.  */
  9. class QueryBuilderSubscriber implements EventSubscriberInterface
  10. {
  11.     public function items(ItemsEvent $event): void
  12.     {
  13.         if (!$event->target instanceof QueryBuilder) {
  14.             return;
  15.         }
  16.         $event->target $event->target->getQuery();
  17.     }
  18.     public static function getSubscribedEvents(): array
  19.     {
  20.         return [
  21.             'knp_pager.items' => ['items'10/*make sure to transform before any further modifications*/],
  22.         ];
  23.     }
  24. }