Symfony2: Session Global variable in PHP template Symfony2: Session Global variable in PHP template symfony symfony

Symfony2: Session Global variable in PHP template


In twig: {{ app.session.varname }}

In PHP: echo $app->getSession()->get('uid');


$session = $this->get('session');if ($session->has('varname')) {    echo $session->varname} 


have you tried to error_log $app->getSession() to see what it returns?

error_log(var_dump($app->getSession(), true));