44 lines
2.2 KiB
PHP
44 lines
2.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace MintyPHP\Module\Notifications;
|
||
|
|
|
||
|
|
use MintyPHP\App\AppContainer;
|
||
|
|
use MintyPHP\App\Container\ContainerRegistrar;
|
||
|
|
use MintyPHP\Module\Notifications\Handler\NotificationCleanupJobHandler;
|
||
|
|
use MintyPHP\Module\Notifications\Listeners\UserCreatedNotificationListener;
|
||
|
|
use MintyPHP\Module\Notifications\Listeners\UserDeletedNotificationListener;
|
||
|
|
use MintyPHP\Module\Notifications\Service\NotificationRepositoryFactory;
|
||
|
|
use MintyPHP\Module\Notifications\Service\NotificationService;
|
||
|
|
use MintyPHP\Module\Notifications\Service\NotificationServicesFactory;
|
||
|
|
use MintyPHP\Repository\Tenant\UserTenantRepositoryInterface;
|
||
|
|
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||
|
|
|
||
|
|
final class NotificationsContainerRegistrar implements ContainerRegistrar
|
||
|
|
{
|
||
|
|
public function register(AppContainer $container): void
|
||
|
|
{
|
||
|
|
$container->set(NotificationRepositoryFactory::class, static fn (): NotificationRepositoryFactory => new NotificationRepositoryFactory());
|
||
|
|
|
||
|
|
$container->set(NotificationServicesFactory::class, static fn (AppContainer $c): NotificationServicesFactory => new NotificationServicesFactory(
|
||
|
|
$c->get(NotificationRepositoryFactory::class)
|
||
|
|
));
|
||
|
|
|
||
|
|
$container->set(NotificationService::class, static fn (AppContainer $c): NotificationService => $c->get(NotificationServicesFactory::class)->createNotificationService());
|
||
|
|
|
||
|
|
$container->set(NotificationCleanupJobHandler::class, static fn (AppContainer $c): NotificationCleanupJobHandler => new NotificationCleanupJobHandler(
|
||
|
|
$c->get(NotificationService::class)
|
||
|
|
));
|
||
|
|
|
||
|
|
$container->set(UserCreatedNotificationListener::class, static fn (AppContainer $c): UserCreatedNotificationListener => new UserCreatedNotificationListener(
|
||
|
|
$c->get(NotificationService::class),
|
||
|
|
$c->get(UserReadRepositoryInterface::class),
|
||
|
|
$c->get(UserTenantRepositoryInterface::class)
|
||
|
|
));
|
||
|
|
|
||
|
|
$container->set(UserDeletedNotificationListener::class, static fn (AppContainer $c): UserDeletedNotificationListener => new UserDeletedNotificationListener(
|
||
|
|
$c->get(NotificationService::class),
|
||
|
|
$c->get(UserReadRepositoryInterface::class)
|
||
|
|
));
|
||
|
|
}
|
||
|
|
}
|