<?php
declare(strict_types=1);
namespace App\Event;
use App\Event\AccountScoringEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use App\Services\Scoring\SaveAccountScoreService;
class AccountScoringSubscriber implements EventSubscriberInterface
{
public function __construct(
private SaveAccountScoreService $saveAccountScoreService
) {
}
public static function getSubscribedEvents()
{
return [
AccountScoringEvent::NAME => 'onAccountScoring',
];
}
public function onAccountScoring(AccountScoringEvent $event): void
{
$this->saveAccountScoreService->saveScore(
$event->getAccount()
);
}
}