diff --git a/src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseNotificationFlagProvider.php b/src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseNotificationFlagProvider.php new file mode 100644 index 000000000..c44b45810 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseNotificationFlagProvider.php @@ -0,0 +1,20 @@ + + */ + private array $notificationFlagProviders; + + public function __construct( + iterable $notificaitonFlagProviders, + ) { + $this->notificationFlagProviders = iterator_to_array($notificaitonFlagProviders); + } + + public function getAllNotificationFlagProviders(): array + { + return $this->notificationFlagProviders; + } + + public function getNotificationFlagProviderByLabel(string $label): ?NotificationFlagProviderInterface + { + foreach ($this->notificationFlagProviders as $provider) { + if ($provider->getLabel() == $label) { + return $provider; + } + } + + return null; + } +} diff --git a/src/Bundle/ChillMainBundle/config/services/notification.yaml b/src/Bundle/ChillMainBundle/config/services/notification.yaml index be3252003..82ab9b29e 100644 --- a/src/Bundle/ChillMainBundle/config/services/notification.yaml +++ b/src/Bundle/ChillMainBundle/config/services/notification.yaml @@ -12,6 +12,10 @@ services: arguments: $routeParameters: '%chill_main.notifications%' + Chill\MainBundle\Notification\NotificationFlagManager: + arguments: + $notificationFlagProviders: !tagged_iterator chill_main.notification_flag_provider + Chill\MainBundle\Notification\NotificationHandlerManager: arguments: $handlers: !tagged_iterator chill_main.notification_handler