From 5ae76f1e55483d52edaf5a5d2a16ae2232c46368 Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 11 Feb 2012 12:26:34 +0545 Subject: [PATCH] [HttpFoundation] Update documentation. --- CHANGELOG-2.1.md | 3 +++ UPGRADE-2.1.md | 29 +++++++++++++++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CHANGELOG-2.1.md b/CHANGELOG-2.1.md index cf9c8c20a7..848bb20174 100644 --- a/CHANGELOG-2.1.md +++ b/CHANGELOG-2.1.md @@ -304,6 +304,9 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c attributes storage behaviour from 2.0.x (default). * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for namespace session attributes. + * Flash API can stores messages in an array so there may be multiple messages + per flash type. The old `Session` class API remains without BC break as it + will single messages as before. ### HttpKernel diff --git a/UPGRADE-2.1.md b/UPGRADE-2.1.md index 2a4927a5ec..556ff78ac6 100644 --- a/UPGRADE-2.1.md +++ b/UPGRADE-2.1.md @@ -306,16 +306,6 @@ UPGRADE FROM 2.0 to 2.1 Before: - ``` - {% if app.session.hasFlash('notice') %} -
- {{ app.session.flash('notice') }} -
- {% endif %} - ``` - - After: - ``` {% if app.session.flashbag.has('notice') %}
@@ -323,14 +313,25 @@ UPGRADE FROM 2.0 to 2.1
{% endif %} ``` + After: + + ``` + {% for flashMessage in app.session.flashbag.get('notice') %} +
+ {{ flashMessage }} +
+ {% endfor %} + ``` You can process all flash messges in a single loop with: ``` - {% for type, flashMessage in app.session.flashbag.all() %} -
- {{ flashMessage }} -
+ {% for type, flashMessages in app.session.flashbag.all() %} + {% for flashMessage in flashMessages) %} +
+ {{ flashMessage }} +
+ {% endfor %} {% endfor %} ```