Reputation: 310
In Symfony2, how to access session object and check whether Session is set or not from a twig file?
Upvotes: 0
Views: 317
Reputation: 1503
It's a pretty easy stuff.
You can access the session with this shortcut:
{{ app.session.get('key') }}
Also check for existence:
{{ app.session.has('key') }}
Upvotes: 2