src/EventSubscriber/Profile/NotificationSubscriber.php line 34

Open in your IDE?
  1. <?php
  2. /*
  3.  * @since 1.0.0
  4.  * @copyright Copyright (C) 2020 ArtMedia. All rights reserved.
  5.  * @website http://artmedia.biz.pl
  6.  * @author Arkadiusz Tobiasz
  7.  * @email kontakt@artmedia.biz.pl
  8.  */
  9. namespace App\EventSubscriber\Profile;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. use App\Events\Core\NotificationAddEvent;
  12. use Symfony\Contracts\Translation\TranslatorInterface;
  13. use App\Entity\Profile\Travel;
  14. class NotificationSubscriber implements EventSubscriberInterface
  15. {
  16.     private $translator;
  17.     public function __construct(
  18.         TranslatorInterface $translator
  19.     ) {
  20.         $this->translator $translator;
  21.     }
  22.     public static function getSubscribedEvents(): array
  23.     {
  24.         return [
  25.             NotificationAddEvent::NAME => 'onNotificationAddEvent',
  26.         ];
  27.     }
  28.     public function onNotificationAddEvent(NotificationAddEvent $event): void
  29.     {
  30.         $event->addNotification(Travel::RADIUS_NOTIFICATION$this->translator->trans('Someone I follow arranges a travel in my area', [], 'email_notification'));
  31.     }
  32. }