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