src/Core/EventSubscriber/CreateCompetitionSubscriber.php line 27

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Core\EventSubscriber;
  4. use App\Core\Event\CreateCompetitionEvent;
  5. use App\Core\Service\FastProcessor\CompetitionProcessor;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class CreateCompetitionSubscriber implements EventSubscriberInterface
  8. {
  9.     private CompetitionProcessor $competitionProcessor;
  10.     public function __construct(CompetitionProcessor $competitionProcessor)
  11.     {
  12.         $this->competitionProcessor $competitionProcessor;
  13.     }
  14.     public static function getSubscribedEvents(): array
  15.     {
  16.         return [
  17.             CreateCompetitionEvent::class => 'createCompetition',
  18.         ];
  19.     }
  20.     public function createCompetition(CreateCompetitionEvent $event)
  21.     {
  22.         $this->competitionProcessor->create($event->getTournament(), $event->getData());
  23.     }
  24. }