src/EventListener/LocaleListener.php line 28
<?php
namespace App\EventListener;
use App\Controller\ServiziController;
use Symfony\Component\HttpKernel\Event\RequestEvent;
/**
* Class LocaleListener
* @package App\EventListener
*/
class LocaleListener
{
protected $servizi;
/**
* LocaleListener constructor.
*/
public function __construct(ServiziController $servizi)
{
$this->servizi = $servizi;
}
/**
* @param RequestEvent $event
*/
public function onKernelRequest(RequestEvent $event)
{
$request = $event->getRequest();
$locale = $request->cookies->get('_locale');
if($locale) {
$request->setLocale($locale);
}
}
}