added event to send email to user (#5034)

This commit is contained in:
Kevin Papst
2024-08-28 14:04:36 +02:00
committed by GitHub
parent 9d933f62c0
commit a19426147a
4 changed files with 35 additions and 5 deletions

View File

@@ -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());
}
}