Last active
August 26, 2022 18:44
-
-
Save mikemix/d7dc0a9c2c3bcdab6b7538d34c5c3c0e to your computer and use it in GitHub Desktop.
Revisions
-
mikemix revised this gist
Aug 26, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,6 +33,6 @@ public function sendNotification(PostRegistrationEvent $event): void { $notification = ($this->notificationFactory($event->getUser()); $this->notificationManager->send([$notification]); } } -
mikemix revised this gist
Aug 21, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,8 @@ use App\Notification\EmailNotificationInterface; use App\Notification\NotificationManagerInterface; use App\Events\PostRegistrationEvent; use App\User\Notification\WelcomeGreetingEmailNotificationFactory; use Symfony\Component\EventDispatcher\EventSubscriberInterface; final class EmailNotification implements EventSubscriberInterface { @@ -23,6 +23,7 @@ public function __construct( $this->notificationFactory = $notificationFactory; } /** {@inheritDoc} */ public static function getSubscribedEvents(): array { return [PostRegistrationEvent::NAME => 'sendNotification']; -
mikemix created this gist
Aug 21, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ <?php declare(strict_types=1); namespace App\User\Notification; use App\Notification\EmailNotificationInterface; use App\Notification\NotificationManagerInterface; use App\Events\PostRegistrationEvent; use App\Events\EventSubscriberInterface; use App\User\Notification\WelcomeGreetingEmailNotificationFactory; final class EmailNotification implements EventSubscriberInterface { private NotificationManagerInterface $notificationManager; private WelcomeGreetingEmailNotificationFactory $notificationFactory; public function __construct( NotificationManagerInterface $notificationManager, WelcomeGreetingEmailNotificationFactory $notificationFactory ) { $this->notificationManager = $notificationManager; $this->notificationFactory = $notificationFactory; } public static function getSubscribedEvents(): array { return [PostRegistrationEvent::NAME => 'sendNotification']; } public function sendNotification(PostRegistrationEvent $event): void { $notification = ($this->notificationFactory($event->getUser()); $this->notificationManager->send($notification); } }