Skip to content

Commit a33a9c6

Browse files
committed
[symfony#1709] Fixing flashbag template rendering in quick tour
1 parent 480896e commit a33a9c6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

quick_tour/the_controller.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,13 @@ You can also store small messages that will only be available for the very
137137
next request::
138138

139139
// store a message for the very next request (in a controller)
140-
$session->getFlashBag()->set('notice', 'Congratulations, your action succeeded!');
140+
$session->getFlashBag()->add('notice', 'Congratulations, your action succeeded!');
141141

142-
// display the message back in the next request (in a template)
143-
{{ app.session.flashBag.get('notice') }}
142+
// display any messages back in the next request (in a template)
143+
144+
{% for flashMessage in app.session.flashbag.get('notice') %}
145+
<div>{{ flashMessage }}</div>
146+
{% endfor %}
144147

145148
This is useful when you need to set a success message before redirecting
146149
the user to another page (which will then show the message). Please note that

0 commit comments

Comments
 (0)