bundles/mldev-account-bundle/src/Event/Subscriber/RegistrationSubscriber.php line 48

Open in your IDE?
  1. <?php
  2. namespace MLDev\AccountBundle\Event\Subscriber;
  3. use MLDev\AccountBundle\Event\RegistrationAccount;
  4. use Swift_Mailer;
  5. use Symfony\Component\DependencyInjection\ContainerInterface;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. use Twig\Environment;
  8. class RegistrationSubscriber implements EventSubscriberInterface
  9. {
  10.     /**
  11.      * @var Swift_Mailer
  12.      */
  13.     private $mailer;
  14.     /**
  15.      * @var Environment
  16.      */
  17.     private $twig;
  18.     /**
  19.      * @var array
  20.      */
  21.     private $parameters;
  22.     /**
  23.      * RecoverySubscriber constructor.
  24.      */
  25.     public function __construct(Swift_Mailer $mailerEnvironment $twig, array $parameters)
  26.     {
  27.         $this->mailer $mailer;
  28.         $this->twig $twig;
  29.         $this->parameters $parameters;
  30.     }
  31.     public static function getSubscribedEvents()
  32.     {
  33.         return [
  34.             RegistrationAccount::NOTIFY_AFTER => [
  35.                 ['onNotifyAfter'10]
  36.             ]
  37.         ];
  38.     }
  39.     public function onNotifyAfter(RegistrationAccount $event)
  40.     {
  41.         if (!filter_var($event->getAccount()->getEmail(), FILTER_VALIDATE_EMAIL)) {
  42.             return null;
  43.         }
  44.         $mldevAccountMail $this->parameters;
  45.     }
  46. }