vendor/store.shopware.com/viob2bworkflow/src/Storefront/Subscriber/AccountOrderSubscriber.php line 32

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Vio\B2BWorkflow\Storefront\Subscriber;
  4. use Shopware\Storefront\Event\RouteRequest\OrderRouteRequestEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Vio\B2BWorkflow\Services\StateService;
  7. class AccountOrderSubscriber implements EventSubscriberInterface
  8. {
  9.     private StateService $stateService;
  10.     public function __construct(StateService $stateService)
  11.     {
  12.         $this->stateService $stateService;
  13.     }
  14.     /**
  15.      * @return array|string[]
  16.      */
  17.     public static function getSubscribedEvents(): array
  18.     {
  19.         return [
  20.             OrderRouteRequestEvent::class => 'onOrderRouteRequest'
  21.         ];
  22.     }
  23.     /**
  24.      * @param OrderRouteRequestEvent $event
  25.      */
  26.     public function onOrderRouteRequest(OrderRouteRequestEvent $event): void
  27.     {
  28.         $criteria $event->getCriteria();
  29.         $context $event->getContext();
  30.         $this->stateService->addExcludeFilter($criteria$context);
  31.     }
  32. }