1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
class SessionResetListener
{
private $container;
public function __construct($container)
{
$this->container = $container;
}
public function onKernelResponse(FilterResponseEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
return;
}
$request = $this->container->get('request');
$routeName = $request->get('_route');
if($routeName != 'corfiche_index' && $routeName != 'corfiche_voir'){
$session = $this->container->get('session');
if ($session->has('searchCriteria')) {
$session->remove('searchCriteria');
$session->save();
}
}
}
} |