vendor/knplabs/knp-components/src/Knp/Component/Pager/Event/Subscriber/Filtration/FiltrationSubscriber.php line 16

Open in your IDE?
  1. <?php
  2. namespace Knp\Component\Pager\Event\Subscriber\Filtration;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Knp\Component\Pager\Event\BeforeEvent;
  5. class FiltrationSubscriber implements EventSubscriberInterface
  6. {
  7.     /**
  8.      * Lazy-load state tracker
  9.      * @var bool
  10.      */
  11.     private $isLoaded false;
  12.     public function before(BeforeEvent $event)
  13.     {
  14.         // Do not lazy-load more than once
  15.         if ($this->isLoaded) {
  16.             return;
  17.         }
  18.         $disp $event->getEventDispatcher();
  19.         // hook all standard filtration subscribers
  20.         $disp->addSubscriber(new Doctrine\ORM\QuerySubscriber());
  21.         $disp->addSubscriber(new PropelQuerySubscriber());
  22.         $this->isLoaded true;
  23.     }
  24.     public static function getSubscribedEvents()
  25.     {
  26.         return array(
  27.             'knp_pager.before' => array('before'1),
  28.         );
  29.     }
  30. }