*/ class PasswordRequestEventSubscriber implements EventSubscriberInterface { protected MailNotifier $notifier; protected UrlGeneratorInterface $urlGenerator; public function __construct(MailNotifier $notifier, UrlGeneratorInterface $urlGenerator) { $this->notifier = $notifier; $this->urlGenerator = $urlGenerator; } public static function getSubscribedEvents() { return [ PasswordRequestEvent::EVENT => 'onRequest', ]; } public function onRequest(PasswordRequestEvent $event) { $this->notifier ->setFrom('system@tinternet.net') ->setSubject('[Tinternet & cie] Mot de passe perdu') ->addRecipient($event->getUser()->getEmail()) ->notify('resetting_request', [ 'reseting_update_link' => $this->urlGenerator->generate( 'auth_resetting_update', [ 'token' => $event->getUser()->getConfirmationToken(), ], UrlGeneratorInterface::ABSOLUTE_URL ), ]) ; } }