custom/plugins/ProxaEmployee/src/Subscribers/FlowSubscriber.php line 40

Open in your IDE?
  1. <?php
  2. namespace ProxaEmployee\Subscribers;
  3. use ProxaEmployee\Services\ConfigService;
  4. use Shopware\Core\Content\Flow\Events\FlowSendMailActionEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class FlowSubscriber implements EventSubscriberInterface
  7. {
  8.     /**
  9.      * @var ConfigService
  10.      */
  11.     private ConfigService $configService;
  12.     /**
  13.      * @param ConfigService $configService
  14.      */
  15.     public function __construct(
  16.         ConfigService $configService
  17.     )
  18.     {
  19.         $this->configService $configService;
  20.     }
  21.     /**
  22.      * @return string[]
  23.      */
  24.     public static function getSubscribedEvents(): array
  25.     {
  26.         return [
  27.             FlowSendMailActionEvent::class => 'onFlowSendMailActionEvent'
  28.         ];
  29.     }
  30.     /**
  31.      * @param FlowSendMailActionEvent $event
  32.      * @return void
  33.      */
  34.     public function onFlowSendMailActionEvent(FlowSendMailActionEvent $event)
  35.     {
  36.         if ($event->getFlowEvent()->getName() === 'checkout.customer.register') {
  37.             $this->configService->setDefaultCustomerRegisterMailTemplateId($event->getMailTemplate()->getId());
  38.         }
  39.     }
  40. }