<?php
declare(strict_types=1);
namespace App\EventSubscriber;
use App\Event\BullhornEventFormSubmitEvent;
use App\Event\EventRegistrationEvent;
use FOS\HttpCacheBundle\CacheManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class HttpCacheClearSubscriber implements EventSubscriberInterface
{
public function __construct(protected readonly CacheManager $cacheManager)
{
}
public function onEventRegistrationEvent(EventRegistrationEvent $event): void
{
$this->cacheManager->invalidateTags(['event-detail', 'events']);
}
public static function getSubscribedEvents(): array
{
return [
EventRegistrationEvent::class => 'onEventRegistrationEvent',
BullhornEventFormSubmitEvent::class => 'onEventRegistrationEvent',
];
}
}