custom/plugins/SwagB2bPlatform/components/OrderSalesRepresentative/BridgePlatform/OrderSalesRepresentativeSubscriber.php line 29

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\B2B\OrderSalesRepresentative\BridgePlatform;
  3. use Shopware\B2B\Order\BridgePlatform\OrderContextCreatedEvent;
  4. use Shopware\B2B\OrderSalesRepresentative\Framework\OrderSalesRepresentativeService;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class OrderSalesRepresentativeSubscriber implements EventSubscriberInterface
  7. {
  8.     /**
  9.      * @var OrderSalesRepresentativeService
  10.      */
  11.     private $orderSalesRepresentativeService;
  12.     public function __construct(
  13.         OrderSalesRepresentativeService $orderSalesRepresentativeService
  14.     ) {
  15.         $this->orderSalesRepresentativeService $orderSalesRepresentativeService;
  16.     }
  17.     public static function getSubscribedEvents(): array
  18.     {
  19.         return [
  20.             OrderContextCreatedEvent::class => 'subscribeToOrderContextCreated',
  21.         ];
  22.     }
  23.     public function subscribeToOrderContextCreated(OrderContextCreatedEvent $event): void
  24.     {
  25.         $this->orderSalesRepresentativeService->addSalesRepresentativeToOrder($event->getOrderContext());
  26.     }
  27. }