@@ -604,12 +604,13 @@ session.
604604Flash Messages
605605~~~~~~~~~~~~~~
606606
607- You can also store small messages that will be stored on the user's session.
608- This is useful when processing a form:
609- you want to redirect and have a special message shown on the *next * page.
610- These types of messages are called "flash" messages.
607+ You can also store special messages, called "flash" messages, on the user's
608+ session. By design, flash messages are meant to be processed exactly once. This
609+ means that they vanish from the session automatically as soon as they are
610+ retrieved. This feature makes "flash" messages particularly suited for storing
611+ user notifications.
611612
612- For example, imagine you're processing a form submit ::
613+ Consider the following form processing example ::
613614
614615 use Symfony\Component\HttpFoundation\Request;
615616
@@ -633,12 +634,12 @@ For example, imagine you're processing a form submit::
633634 return $this->render(...);
634635 }
635636
636- After processing the request, the controller sets a `` notice `` flash message
637- in the session and then redirects. The name (``notice ``) isn't significant -
638- it's just something you invent and reference next .
637+ After processing the request, the controller sets a flash message in the session
638+ and then redirects. The message key (``notice `` in this example) can be freely
639+ chosen and is used to retrieve the message content .
639640
640641In the template of the next page (or even better, in your base layout template),
641- the following code will render the ``notice `` message :
642+ the following code will render the messages stored under the ``notice `` key :
642643
643644.. configuration-block ::
644645
@@ -660,9 +661,9 @@ the following code will render the ``notice`` message:
660661
661662.. note ::
662663
663- By design, flash messages are meant to be processed exactly once. This means
664- that they vanish from the session automatically when they are retrieved from
665- the flash bag by calling the `` get() `` method .
664+ It's common to use `` notice ``, `` warning `` and `` error` as the keys of the
665+ different types of flash messages, but you can use any key that fits your
666+ needs .
666667
667668.. tip::
668669
0 commit comments