Skip to content

Commit f546b9e

Browse files
committed
Merge branch '2.2'
2 parents 9dc1b5f + 436b7fb commit f546b9e

File tree

4 files changed

+60
-5
lines changed

4 files changed

+60
-5
lines changed

components/http_foundation/introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The HttpFoundation Component
1010
specification.
1111

1212
In PHP, the request is represented by some global variables (``$_GET``,
13-
``$_POST``, ``$_FILE``, ``$_COOKIE``, ``$_SESSION``, ...) and the response is
13+
``$_POST``, ``$_FILES``, ``$_COOKIE``, ``$_SESSION``, ...) and the response is
1414
generated by some functions (``echo``, ``header``, ``setcookie``, ...).
1515

1616
The Symfony2 HttpFoundation component replaces these default PHP global
@@ -61,7 +61,7 @@ can be accessed via several public properties:
6161

6262
* ``attributes``: no equivalent - used by your app to store other data (see :ref:`below<component-foundation-attributes>`)
6363

64-
* ``files``: equivalent of ``$_FILE``;
64+
* ``files``: equivalent of ``$_FILES``;
6565

6666
* ``server``: equivalent of ``$_SERVER``;
6767

cookbook/controller/error_pages.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ control you need:
1616

1717
1. Customize the error templates of the different error pages (explained below);
1818

19-
2. Replace the default exception controller ``TwigBundle::Exception:show``
19+
2. Replace the default exception controller ``twig.controller.exception:showAction``
2020
with your own controller and handle it however you want (see
21-
:ref:`exception_controller in the Twig reference<config-twig-exception-controller>`);
21+
:ref:`exception_controller in the Twig reference<config-twig-exception-controller>`).
22+
The default exception controller is registered as a service - the actual
23+
class is ``Symfony\Bundle\TwigBundle\Controller\ExceptionController``.
2224

2325
.. tip::
2426

cookbook/testing/database.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ it's easy to pass a mock object within a test::
9191
->will($this->returnValue($employeeRepository));
9292
9393
$salaryCalculator = new SalaryCalculator($entityManager);
94-
$this->assertEquals(1100, $salaryCalculator->calculateTotalSalary(1));
94+
$this->assertEquals(2100, $salaryCalculator->calculateTotalSalary(1));
9595
}
9696
}
9797

reference/dic_tags.rst

+53
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ may also be tags in other bundles you use that aren't listed here.
4141
+-----------------------------------+---------------------------------------------------------------------------+
4242
| `form.type_guesser`_ | Add your own logic for "form type guessing" |
4343
+-----------------------------------+---------------------------------------------------------------------------+
44+
| `kernel.cache_clearer`_ | Register your service to be called during the cache clearing process |
45+
+-----------------------------------+---------------------------------------------------------------------------+
4446
| `kernel.cache_warmer`_ | Register your service to be called during the cache warming process |
4547
+-----------------------------------+---------------------------------------------------------------------------+
4648
| `kernel.event_listener`_ | Listen to different events/hooks in Symfony |
@@ -342,6 +344,57 @@ tag its service definition with ``form.type_guesser`` (it has no options).
342344
To see an example of how this class might look, see the ``ValidatorTypeGuesser``
343345
class in the ``Form`` component.
344346
347+
kernel.cache_clearer
348+
--------------------
349+
350+
**Purpose**: Register your service to be called during the cache clearing process
351+
352+
Cache clearing occurs whenever you call ``cache:clear`` command. If your
353+
bundle caches files, you should add custom cache clearer for clearing those
354+
files during the cache clearing process.
355+
356+
In order to register your custom cache clearer, first you must create a
357+
service class::
358+
359+
// src/Acme/MainBundle/Cache/MyClearer.php
360+
namespace Acme\MainBundle\Cache;
361+
362+
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
363+
364+
class MyClearer implements CacheClearerInterface
365+
{
366+
public function clear($cacheDir)
367+
{
368+
// clear your cache
369+
}
370+
371+
}
372+
373+
Then register this class and tag it with ``kernel.cache:clearer``:
374+
375+
.. configuration-block::
376+
377+
.. code-block:: yaml
378+
379+
services:
380+
my_cache_clearer:
381+
class: Acme\MainBundle\Cache\MyClearer
382+
tags:
383+
- { name: kernel.cache_clearer }
384+
385+
.. code-block:: xml
386+
387+
<service id="my_cache_clearer" class="Acme\MainBundle\Cache\MyClearer">
388+
<tag name="kernel.cache_clearer" />
389+
</service>
390+
391+
.. code-block:: php
392+
393+
$container
394+
->register('my_cache_clearer', 'Acme\MainBundle\Cache\MyClearer')
395+
->addTag('kernel.cache_clearer')
396+
;
397+
345398
kernel.cache_warmer
346399
-------------------
347400

0 commit comments

Comments
 (0)