Skip to content

Commit 46e2505

Browse files
Cydonia7wouterj
authored andcommitted
Changed to addFlash where it is possible (ie in controllers)
1 parent 643c458 commit 46e2505

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

book/controller.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ For example, imagine you're processing a form submit::
617617
if ($form->isValid()) {
618618
// do some sort of processing
619619

620-
$request->getSession()->getFlashBag()->add(
620+
$this->addFlash(
621621
'notice',
622622
'Your changes were saved!'
623623
);
@@ -632,10 +632,6 @@ After processing the request, the controller sets a ``notice`` flash message
632632
in the session and then redirects. The name (``notice``) isn't significant -
633633
it's just something you invent and reference next.
634634

635-
.. versionadded:: 2.6
636-
You can use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller::addFlash`
637-
method as a shortcut to ``$this->get('session')->getFlashBag()->add(...)``.
638-
639635
In the template of the next action, the following code could be used to render
640636
the ``notice`` message:
641637

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy