src/EventSubscriber/WeblinkEventSubscriber.php line 28

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by Elements.at New Media Solutions GmbH
  4.  *
  5.  */
  6. namespace App\EventSubscriber;
  7. use App\Model\Shop\Order;
  8. use App\Service\Shop\MailService;
  9. use Elements\Bundle\SkidataTicketingSwebBundle\Event\WeblinkEvent;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. class WeblinkEventSubscriber implements EventSubscriberInterface
  12. {
  13.     public function __construct(protected MailService $mailService)
  14.     {
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             WeblinkEvent::NAME => 'onWeblinkEvent',
  20.         ];
  21.     }
  22.     public function onWeblinkEvent(WeblinkEvent $event): void
  23.     {
  24.         $order Order::getById($event->getOrderId());
  25.         if (!$order->getCompletionEmailSent()) {
  26.             $this->mailService->sendCompletionMail($order);
  27.         }
  28.     }
  29. }