src/Event/AccountScoringSubscriber.php line 25

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Event;
  4. use App\Event\AccountScoringEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use App\Services\Scoring\SaveAccountScoreService;
  7. class AccountScoringSubscriber implements EventSubscriberInterface
  8. {
  9.     public function __construct(
  10.         private SaveAccountScoreService $saveAccountScoreService
  11.     ) {
  12.     }
  13.     public static function getSubscribedEvents()
  14.     {
  15.         return [
  16.             AccountScoringEvent::NAME => 'onAccountScoring',
  17.         ];
  18.     }
  19.     public function onAccountScoring(AccountScoringEvent $event): void
  20.     {
  21.         $this->saveAccountScoreService->saveScore(
  22.             $event->getAccount()
  23.         );
  24.     }
  25. }