8000 Update flashbag syntax and add note on flash session lifetime · fixe/symfony-docs@65be337 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 65be337

Browse files
committed
Update flashbag syntax and add note on flash session lifetime
1 parent e254aac commit 65be337

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

quick_tour/the_controller.rst

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ 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->setFlash('notice', 'Congratulations, your action succeeded!');
140+
$session->getFlashBag()->set('notice', 'Congratulations, your action succeeded!');
141141

142142
// display the message back in the next request (in a template)
143-
{{ app.session.flash('notice') }}
143+
{{ app.session.flashBag.get('notice') }}
144144

145145
This is useful when you need to set a success message before redirecting
146-
the user to another page (which will then show the message). Please not that
147-
when you use hasFlash or getFlash instead of flash, the flash message will
148-
not be cleared and thus remain visible during following requests.
146+
the user to another page (which will then show the message). Please note that
147+
when you use has() instead of get(), the flash message will not be cleared and
148+
thus remain visible during following requests.
149149

150150
Securing Resources
151151
------------------

0 commit comments

Comments
 (0)
0