src/MailBundle/EventListener/ValidationRequest/ValidationRequestAskUnlockEventListener.php line 30

Open in your IDE?
  1. <?php
  2. namespace App\MailBundle\EventListener\ValidationRequest;
  3. use App\Entity\Staff\Staff;
  4. use App\Entity\ValidationRequest;
  5. use App\Event\ValidationRequest\ValidationRequestAskUnlockEvent;
  6. use App\MailBundle\Entity\Mail;
  7. use App\MailBundle\EventListener\MailListener;
  8. use App\MailBundle\Exception\MissingTemplateException;
  9. use App\MailBundle\Service\MailSender;
  10. use JetBrains\PhpStorm\NoReturn;
  11. use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
  12. use Symfony\Contracts\EventDispatcher\Event;
  13. use Twig\Error\LoaderError;
  14. use Twig\Error\RuntimeError;
  15. use Twig\Error\SyntaxError;
  16. class ValidationRequestAskUnlockEventListener extends ValidationRequestEventListener
  17. {
  18.     /**
  19.      * @throws SyntaxError
  20.      * @throws MissingTemplateException
  21.      * @throws TransportExceptionInterface
  22.      * @throws RuntimeError
  23.      * @throws LoaderError
  24.      */
  25.     #[NoReturn]
  26.     public function onRequestUnlockValidationRequestEvent(ValidationRequestAskUnlockEvent $event)
  27.     {
  28.         $validationRequest $event?->getValidationRequest();
  29.         $from $validationRequest?->getUnlockRequestedBy();
  30.         $this->sendMail($validationRequest$fromMail::REQUEST_UNLOCK_TEMPLATE);
  31.     }
  32. }