- <?php
- 
- namespace App\Domain\Auth\Subscriber;
- 
- use App\Domain\Auth\Event\UserCreatedEvent;
- use App\Domain\Auth\Service\UserRegisterService;
- use Symfony\Component\EventDispatcher\EventSubscriberInterface;
- 
- class UserCreatedEventSubscriber implements EventSubscriberInterface
- {
-     private UserRegisterService $service;
- 
-     public function __construct(UserRegisterService $service)
-     {
-         $this->service = $service;
-     }
- 
-     public static function getSubscribedEvents(): array
-     {
-         return [
-             UserCreatedEvent::class => 'onCreated',
-         ];
-     }
- 
-     public function onCreated(UserCreatedEvent $event): void
-     {
-         $this->service->updateUser($event->getUser());
-     }
- }