src/Event/AccountOpeningSubscriber.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Event;
  3. use App\Service\MailerService;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class AccountOpeningSubscriber implements EventSubscriberInterface
  6. {
  7.     /** @var MailerService */
  8.     protected $mailer;
  9.     public function __construct(MailerService $mailer)
  10.     {
  11.         $this->mailer $mailer;
  12.     }
  13.     /**
  14.      * Send email to Malys and user to inform account opening
  15.      *
  16.      * @throws \Twig_Error_Loader
  17.      * @throws \Twig_Error_Runtime
  18.      * @throws \Twig_Error_Syntax
  19.      */
  20.     public function onLoginAccountOpening(AccountOpeningEvent $event)
  21.     {
  22.         $this->mailer->sendAccountOpeningEmailToMalys($event->getFormData());
  23.         $this->mailer->sendAccountOpeningEmailToUser($event->getFormData());
  24.     }
  25.     public static function getSubscribedEvents(): array
  26.     {
  27.         return [
  28.             AccountOpeningEvents::LOGIN_ACCOUNT_OPENING => ['onLoginAccountOpening'0]
  29.         ];
  30.     }
  31. }