added event to send email to user (#5034)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
use App\Event\EmailEvent;
|
||||
use App\Event\UserEmailEvent;
|
||||
use App\Mail\KimaiMailer;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
@@ -26,6 +27,7 @@ final class EmailSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
return [
|
||||
EmailEvent::class => ['onMailEvent', 100],
|
||||
UserEmailEvent::class => ['onUserMailEvent', 100],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -33,4 +35,9 @@ final class EmailSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
$this->mailer->send($event->getEmail());
|
||||
}
|
||||
|
||||
public function onUserMailEvent(UserEmailEvent $event): void
|
||||
{
|
||||
$this->mailer->sendToUser($event->getUser(), $event->getEmail());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user