vendor/store.shopware.com/swagb2bplatform/components/OrderSalesRepresentative/BridgePlatform/OrderSalesRepresentativeSubscriber.php line 26

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.     private OrderSalesRepresentativeService $orderSalesRepresentativeService;
  9.     public function __construct(
  10.         OrderSalesRepresentativeService $orderSalesRepresentativeService
  11.     ) {
  12.         $this->orderSalesRepresentativeService $orderSalesRepresentativeService;
  13.     }
  14.     public static function getSubscribedEvents(): array
  15.     {
  16.         return [
  17.             OrderContextCreatedEvent::class => 'subscribeToOrderContextCreated',
  18.         ];
  19.     }
  20.     public function subscribeToOrderContextCreated(OrderContextCreatedEvent $event): void
  21.     {
  22.         $this->orderSalesRepresentativeService->addSalesRepresentativeToOrder($event->getOrderContext());
  23.     }
  24. }