custom/plugins/VioRepresentativeLogin/src/Storefront/Subscriber/RegisterEventSubscriber.php line 25

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace VioRepresentativeLogin\Storefront\Subscriber;
  3. use Shopware\Core\Checkout\Customer\Event\CustomerRegisterEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use VioRepresentativeLogin\Core\Services\AgentService;
  6. class RegisterEventSubscriber implements EventSubscriberInterface
  7. {
  8.     private AgentService $agentService;
  9.     public function __construct(AgentService $agentService)
  10.     {
  11.         $this->agentService $agentService;
  12.     }
  13.     public static function getSubscribedEvents(): array
  14.     {
  15.         return [
  16.             CustomerRegisterEvent::class => 'onCustomerRegister'
  17.         ];
  18.     }
  19.     public function onCustomerRegister(CustomerRegisterEvent $event): void
  20.     {
  21.         $salesChannelContext $event->getSalesChannelContext();
  22.         $this->agentService->assignCurrentCustomer($salesChannelContext);
  23.     }
  24. }