app/Plugin/Schedule/EventSubscriber/MyPageEventSubscriber.php line 27

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright(c) 2018 SYSTEM_KD
  4.  * Date: 2018/12/04
  5.  */
  6. namespace Plugin\Schedule\EventSubscriber;
  7. use Doctrine\ORM\QueryBuilder;
  8. use Eccube\Doctrine\Query\Queries;
  9. use Eccube\Event\EccubeEvents;
  10. use Eccube\Event\EventArgs;
  11. use Plugin\Schedule\Repository\QueryKey;
  12. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  13. class MyPageEventSubscriber implements EventSubscriberInterface
  14. {
  15.     private $queries;
  16.     public function __construct(Queries $queries)
  17.     {
  18.         $this->queries $queries;
  19.     }
  20.     public function onFrontMyPageMyPageFavoriteSearch(EventArgs $event)
  21.     {
  22.         /** @var QueryBuilder $qb */
  23.         $qb $event->getArgument('qb');
  24.         $this->queries->customize(QueryKey::CUSTOMER_FAVORITE_PRODUCT_SEARCH$qb, []);
  25.     }
  26.     /**
  27.      * Returns an array of event names this subscriber wants to listen to.
  28.      *
  29.      * The array keys are event names and the value can be:
  30.      *
  31.      * * The method name to call (priority defaults to 0)
  32.      * * An array composed of the method name to call and the priority
  33.      * * An array of arrays composed of the method names to call and respective
  34.      *   priorities, or 0 if unset
  35.      *
  36.      * For instance:
  37.      *
  38.      * * array('eventName' => 'methodName')
  39.      * * array('eventName' => array('methodName', $priority))
  40.      * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
  41.      *
  42.      * @return array The event names to listen to
  43.      */
  44.     public static function getSubscribedEvents()
  45.     {
  46.         return [
  47.             EccubeEvents::FRONT_MYPAGE_MYPAGE_FAVORITE_SEARCH => 'onFrontMyPageMyPageFavoriteSearch'
  48.         ];
  49.     }
  50. }