<?php
declare(strict_types=1);
namespace App\Core\EventSubscriber;
use App\Core\Event\CreateCompetitionRankingEvent;
use App\Core\Service\FastProcessor\CompetitionRankingProcessor;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CreateCompetitionRankingSubscriber implements EventSubscriberInterface
{
private CompetitionRankingProcessor $competitionRankingProcessor;
public function __construct(CompetitionRankingProcessor $competitionRankingProcessor)
{
$this->competitionRankingProcessor = $competitionRankingProcessor;
}
public static function getSubscribedEvents(): array
{
return [
CreateCompetitionRankingEvent::class => 'createCompetitionRanking',
];
}
public function createCompetitionRanking(CreateCompetitionRankingEvent $event)
{
$this->competitionRankingProcessor->create($event->getTournament(), $event->getData());
}
}