Skip to content

Commit

Permalink
fix spelling of the flashBag() method
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Mar 31, 2016
1 parent 2c000cd commit 1da9747
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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>`.

0 comments on commit 1da9747

Please sign in to comment.