How to test if a session already exists?
In Symfony, session
service is an instance of Symfony\Component\HttpFoundation\Session\Session
. That said, session
does provide several method to either check or manipulate session.
In your particular case, you would do something like this:
$session = $request->getSession();
if ( $session->has('login')){
$message = 'Bonjour '.$session->get('login').' vous etes connecté.<br>';
}
But, noting the comment from @Gerry, his question is a very valid one.
Hope this helps...