Reputation: 337
Is there a method to check whether a session exists or not?
I tried this method, but it always gives me a 'Bravo !' answer:
$session = $this->getRequest()->hasPreviousSession();
if($session)
{
return new Response('Bravo !');
}
else
{
return new Response('Oooops !');
}
Upvotes: 9
Views: 8244
Reputation: 52493
$this->container->get('session')->isStarted()
is what you're looking for.
Upvotes: 16