src/EventsSubscriber/Creator/CreatorEventSubscriber.php line 28

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\EventsSubscriber\Creator;
  4. use App\Event\Creator\BannedEvent;
  5. use App\Services\Activity\ActivityServiceInterface;
  6. use App\Services\Payment\PriceService;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. use Symfony\Component\Messenger\MessageBusInterface;
  9. class CreatorEventSubscriber implements EventSubscriberInterface
  10. {
  11.     public static function getSubscribedEvents(): array
  12.     {
  13.         return [
  14.             BannedEvent::class => 'onBanned',
  15.         ];
  16.     }
  17.     public function __construct(
  18.         private readonly PriceService $priceService,
  19.         private readonly MessageBusInterface $bus,
  20.         private readonly ActivityServiceInterface $activityService,
  21.     ) {}
  22.     public function onBanned(BannedEvent $event): void
  23.     {
  24.         $creator $event->getCreator();
  25.         $this->activityService->declineAllActivitiesByCreator($creator->getId(), "You are banned. Contact support");
  26.     }
  27. }