I'm migrating from Symfony 2.0 to Symfony 2.1.
I have the following simple code on my controller:
public function createEntidadeAction() {
$this->get('session')->getFlashBag()->set('error', 'message');
return $this->redirect($this->generateUrl('EntidadeBundle_index'));
}
If I generate an error (for example by passing a bad route), I check on the profiler that the flash message is there.
However if i let the redirect to succeed, the flash message disappears and nothing is displayed. I have the folloing on my corresponding Twig template:
{% for flashMessage in app.session.flashbag.get('error') %}
<div class="flash-notice">
{{ flashMessage }}
</div>
{% endfor %}
I can not figure this out. What am I missing? Flash messages should last after the first redirect, no?
session: storage_id: session.storage.mock_file
so it can have the php.ini configs. – Machinate