I'm trying to access the session variables in the twig which is set in the controller. For some reasons it's not working in twig. I have checked the session variables printing in another controller which is giving the expected result but the variable shows empty in template. I don't know whether I'm missing something in configuration.
//Below is my code in controller
$session = $request->getSession();
$session->set('user', [
'id' => $user->getId(),
'firstName' => $user->getfirstname()
]);
// code in twig
{{ dump(app.session) }}
$sessionvariable over to twig?