src/EventSubscriber/PaginatorSubscriber.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
  4. use Knp\Component\Pager\Event\AfterEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class PaginatorSubscriber implements EventSubscriberInterface
  7. {
  8.     public static function getSubscribedEvents(): array
  9.     {
  10.         return [
  11.             'knp_pager.after' => ['after'1]
  12.         ];
  13.     }
  14.     public function after(AfterEvent $afterEvent): void
  15.     {
  16.         /** @var SlidingPagination $paginator */
  17.         $paginator $afterEvent->getPaginationView();
  18.         $paginator->setParam('id'null);
  19.     }
  20. }