<?php
/*
* @since 1.0.0
* @copyright Copyright (C) 2020 ArtMedia. All rights reserved.
* @website http://artmedia.biz.pl
* @author Arkadiusz Tobiasz
* @email kontakt@artmedia.biz.pl
*/
namespace App\EventSubscriber\Media;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use App\Events\Core\NotificationAddEvent;
use Symfony\Contracts\Translation\TranslatorInterface;
use App\Entity\Media\Credit;
use App\Entity\Media\Photo;
class NotificationSubscriber implements EventSubscriberInterface
{
private $translator;
public function __construct(
TranslatorInterface $translator
) {
$this->translator = $translator;
}
public static function getSubscribedEvents(): array
{
return [
NotificationAddEvent::NAME => 'onNotificationAddEvent',
];
}
public function onNotificationAddEvent(NotificationAddEvent $event): void
{
$event->addNotification(Credit::NOTIFICATION, $this->translator->trans('I get credited in someone else’s portfolio', [], 'email_notification'));
$event->addNotification(Credit::FOLLOW_NOTIFICATION, $this->translator->trans('Someone I follow gets credited in someone’s image', [], 'email_notification'));
$event->addNotification(Photo::FOLLOW_NOTIFICATION, $this->translator->trans('Someone I follow adds a new image', [], 'email_notification'));
}
}