Alex Rivera | Logout

Flash-Messages in Symfony2 doesn't seem to work in my twig-template

Asked 2011-11-23T09:49:26.450
10

I want to add support for flash messages on our pages. I implemented this by following the documentation found here.

I added the following snipplet to my base layout. (i also tried to add it to a specific action template).

{% if app.session.hasFlash('notice') %} 
    <div id="flashmessage" class="flash-notice"> 
       {{ app.session.flash('notice') }} 
   </div> 
{% endif %} 

After adding the following error is thrown

Twig_Error_Runtime: Item "hasFlash" for "" does not exist in "MyBundle::layout.html.twig" at line 66

Is there anything else i need to do ?

Edit
Report

1 Answer

0

I just figure out that flash messages are not working if intercept_redirects is true in debug mode.

answered 2012-05-17T17:00:44.993

Your Answer