Skip to content

Commit

Permalink
[HttpFoundation] Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drak committed Mar 15, 2012
1 parent 910b5c7 commit 5ae76f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG-2.1.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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). attributes storage behaviour from 2.0.x (default).
* Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for
namespace session attributes. 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 ### HttpKernel


Expand Down
21 changes: 11 additions & 10 deletions UPGRADE-2.1.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -307,30 +307,31 @@ UPGRADE FROM 2.0 to 2.1
Before: Before:


``` ```
{% if app.session.hasFlash('notice') %} {% if app.session.flashbag.has('notice') %}
<div class="flash-notice"> <div class="flash-notice">
{{ app.session.flash('notice') }} {{ app.session.flashbag.get('notice') }}
</div> </div>
{% endif %} {% endif %}
``` ```

After: After:


``` ```
{% if app.session.flashbag.has('notice') %} {% for flashMessage in app.session.flashbag.get('notice') %}
<div class="flash-notice"> <div class="flash-notice">
{{ app.session.flashbag.get('notice') }} {{ flashMessage }}
</div> </div>
{% endif %} {% endfor %}
``` ```


You can process all flash messges in a single loop with: You can process all flash messges in a single loop with:


``` ```
{% for type, flashMessage in app.session.flashbag.all() %} {% for type, flashMessages in app.session.flashbag.all() %}
<div class="flash-{{ type }}"> {% for flashMessage in flashMessages) %}
{{ flashMessage }} <div class="flash-{{ type }}">
</div> {{ flashMessage }}
</div>
{% endfor %}
{% endfor %} {% endfor %}
``` ```


Expand Down

0 comments on commit 5ae76f1

Please sign in to comment.