src/Domain/Password/Subscriber/UserCreatedEventSubscriber.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Password\Subscriber;
  3. use App\Domain\Auth\Event\BadPasswordLoginEvent;
  4. use App\Domain\Auth\Event\UserCreatedEvent;
  5. use App\Domain\Auth\Service\LoginAttemptService;
  6. use App\Domain\Auth\Service\UserRegisterService;
  7. use App\Domain\Password\Service\PasswordService;
  8. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  9. class UserCreatedEventSubscriber implements EventSubscriberInterface
  10. {
  11.     private PasswordService $service;
  12.     public function __construct(PasswordService $service)
  13.     {
  14.         $this->service $service;
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             UserCreatedEvent::class => 'onCreated',
  20.         ];
  21.     }
  22.     public function onCreated(UserCreatedEvent $event): void
  23.     {
  24.         $this->service->updatePassword($event->getUser());
  25.     }
  26. }