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

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