local/modules/OpenApi/EventListener/LogoutListener.php line 29

  1. <?php
  2. namespace OpenApi\EventListener;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Symfony\Component\HttpFoundation\RequestStack;
  5. use Thelia\Core\Event\TheliaEvents;
  6. class LogoutListener implements EventSubscriberInterface
  7. {
  8.     protected $request;
  9.     /**
  10.      * @param RequestStack $request
  11.      */
  12.     public function __construct(RequestStack $request)
  13.     {
  14.         $this->request $request;
  15.     }
  16.     public static function getSubscribedEvents()
  17.     {
  18.         return [
  19.             TheliaEvents::CUSTOMER_LOGOUT => ['emptyOrderSession'30]
  20.         ];
  21.     }
  22.     public function emptyOrderSession()
  23.     {
  24.         $this->request->getSession()->set('thelia.order'null);
  25.     }
  26. }