vendor/witalink/mail-tracker-bundle/src/EventSubscriber/Subscriber/MailTrackerSubscriber.php line 40

Open in your IDE?
  1. <?php
  2. namespace Witalink\MailTrackerBundle\EventSubscriber\Subscriber;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Witalink\MailTrackerBundle\EventSubscriber\Event\TemplatedEmailEvent;
  5. use Witalink\MailTrackerBundle\EventSubscriber\MailTrackerEvents;
  6. use Witalink\MailTrackerBundle\Services\MailTrackerService;
  7. class MailTrackerSubscriber implements EventSubscriberInterface
  8. {
  9.     private MailTrackerService $mailTrackerService;
  10.     public function __construct(MailTrackerService $mailTrackerService)
  11.     {
  12.         $this->mailTrackerService $mailTrackerService;
  13.     }
  14.     /**
  15.      * @return array
  16.      */
  17.     public static function getSubscribedEvents()
  18.     {
  19.         return [
  20.             MailTrackerEvents::MAIL_TRACK_START => [
  21.                 [
  22.                     'dispatchStartMailTrack',
  23.                     // Define the priority if necessary
  24.                 ],
  25.             ],
  26.         ];
  27.     }
  28.     /**
  29.      * Dispatch an email once a user is created. This allow him/her to create a password and
  30.      * access the account.
  31.      *
  32.      * @param TemplatedEmailEvent $event
  33.      */
  34.     public function dispatchStartMailTrack(TemplatedEmailEvent $event)
  35.     {
  36.         $this->mailTrackerService->startTrack($event->getTemplatedEmail());
  37.     }
  38. }