[HttpFoundation] Update documentation.
This commit is contained in:
parent
910b5c7f83
commit
5ae76f1e55
@ -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
|
||||||
|
|
||||||
|
@ -306,16 +306,6 @@ UPGRADE FROM 2.0 to 2.1
|
|||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
|
||||||
```
|
|
||||||
{% if app.session.hasFlash('notice') %}
|
|
||||||
<div class="flash-notice">
|
|
||||||
{{ app.session.flash('notice') }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
{% if app.session.flashbag.has('notice') %}
|
{% if app.session.flashbag.has('notice') %}
|
||||||
<div class="flash-notice">
|
<div class="flash-notice">
|
||||||
@ -323,15 +313,26 @@ UPGRADE FROM 2.0 to 2.1
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
```
|
```
|
||||||
|
After:
|
||||||
|
|
||||||
|
```
|
||||||
|
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||||
|
<div class="flash-notice">
|
||||||
|
{{ flashMessage }}
|
||||||
|
</div>
|
||||||
|
{% 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() %}
|
||||||
|
{% for flashMessage in flashMessages) %}
|
||||||
<div class="flash-{{ type }}">
|
<div class="flash-{{ type }}">
|
||||||
{{ flashMessage }}
|
{{ flashMessage }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
```
|
```
|
||||||
|
|
||||||
* Session handler drivers should implement `\SessionHandlerInterface` or extend from
|
* Session handler drivers should implement `\SessionHandlerInterface` or extend from
|
||||||
|
Reference in New Issue
Block a user