<?php
namespace App\EventListener;
use Gedmo\Translatable\TranslatableListener;
use Symfony\Component\HttpKernel\Event\RequestEvent;
class DoctrineTranslatableListener
{
protected TranslatableListener $translatable;
public function setTranslatable(TranslatableListener $translatable): void
{
$this->translatable = $translatable;
}
public function onLateKernelRequest(RequestEvent $requestEvent)
{
$this->translatable->setTranslatableLocale($requestEvent->getRequest()->getLocale());
}
public function onKernelRequest(RequestEvent $requestEvent)
{
$this->translatable->setTranslatableLocale($requestEvent->getRequest()->getLocale());
}
}