src/EventSubscriber/HttpCacheClearSubscriber.php line 18

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\EventSubscriber;
  4. use App\Event\BullhornEventFormSubmitEvent;
  5. use App\Event\EventRegistrationEvent;
  6. use FOS\HttpCacheBundle\CacheManager;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. class HttpCacheClearSubscriber implements EventSubscriberInterface
  9. {
  10.     public function __construct(protected readonly CacheManager $cacheManager)
  11.     {
  12.     }
  13.     public function onEventRegistrationEvent(EventRegistrationEvent $event): void
  14.     {
  15.         $this->cacheManager->invalidateTags(['event-detail''events']);
  16.     }
  17.     public static function getSubscribedEvents(): array
  18.     {
  19.         return [
  20.             EventRegistrationEvent::class => 'onEventRegistrationEvent',
  21.             BullhornEventFormSubmitEvent::class => 'onEventRegistrationEvent',
  22.         ];
  23.     }
  24. }