Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ read any flash messages from the session:

.. code-block:: html+twig

{% for flash_message in app.session.flashbag.get('notice') %}
{% for flash_message in app.session.flashBag.get('notice') %}
<div class="flash-notice">
{{ flash_message }}
</div>
Expand Down
6 changes: 3 additions & 3 deletions cookbook/session/avoid_session_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ that a session is *always* started:

.. code-block:: html+twig

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

Even if the user is not logged in and even if you haven't created any flash messages,
just calling the ``get()`` (or even ``has()``) method of the ``flashbag`` will
just calling the ``get()`` (or even ``has()``) method of the ``flashBag`` will
start a session. This may hurt your application performance because all users will
receive a session cookie. To avoid this behavior, add a check before trying to
access the flash messages:

.. code-block:: html+twig

{% if app.request.hasPreviousSession %}
{% for flashMessage in app.session.flashbag.get('notice') %}
{% for flashMessage in app.session.flashBag.get('notice') %}
<div class="flash-notice">
{{ flashMessage }}
</div>
Expand Down
4 changes: 2 additions & 2 deletions quick_tour/the_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ And you can display the flash message in the template like this:

.. code-block:: html+twig

{% for flashMessage in app.session.flashbag.get('notice') %}
{% for flashMessage in app.session.flashBag.get('notice') %}
<div class="flash-notice">
{{ flashMessage }}
</div>
Expand All @@ -344,4 +344,4 @@ That's all there is to it and I'm not even sure you'll have spent the full
10 minutes. You were briefly introduced to bundles in the first part and
all the features you've learned about so far are part of the core FrameworkBundle.
But thanks to bundles, everything in Symfony can be extended or replaced.
That's the topic of the :doc:`next part of this tutorial <the_architecture>`.
That's the topic of the :doc:`next part of this tutorial <the_architecture>`.