<?php
namespace MLDev\AccountBundle\Event\Subscriber;
use MLDev\AccountBundle\Event\RegistrationAccount;
use Swift_Mailer;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Twig\Environment;
class RegistrationSubscriber implements EventSubscriberInterface
{
/**
* @var Swift_Mailer
*/
private $mailer;
/**
* @var Environment
*/
private $twig;
/**
* @var array
*/
private $parameters;
/**
* RecoverySubscriber constructor.
*/
public function __construct(Swift_Mailer $mailer, Environment $twig, array $parameters)
{
$this->mailer = $mailer;
$this->twig = $twig;
$this->parameters = $parameters;
}
public static function getSubscribedEvents()
{
return [
RegistrationAccount::NOTIFY_AFTER => [
['onNotifyAfter', 10]
]
];
}
public function onNotifyAfter(RegistrationAccount $event)
{
if (!filter_var($event->getAccount()->getEmail(), FILTER_VALIDATE_EMAIL)) {
return null;
}
$mldevAccountMail = $this->parameters;
}
}