*/ class SiteEventSubscriber extends EntityManagerEventSubscriber { public function __construct( protected KernelInterface $kernel, protected SymfonyCacheManager $cacheManager ) { } public function supports(EntityInterface $entity): bool { return $entity instanceof Node || $entity instanceof Menu || $entity instanceof Navigation; } public function onUpdate(EntityManagerEvent $event) { if (!$this->supports($event->getEntity())) { return; } $this->cacheManager->cleanRouting(); } public function onCreate(EntityManagerEvent $event) { return $this->onUpdate($event); } public function onDelete(EntityManagerEvent $event) { return $this->onUpdate($event); } }