Skip to content

Commit 7c2326b

Browse files
committed
Merge branch '2.1' into 2.2
2 parents 28b0904 + c972162 commit 7c2326b

File tree

4 files changed

+57
-4
lines changed

4 files changed

+57
-4
lines changed

components/http_foundation/introduction.rst

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ 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 ``TwigBundle:Exception:show``
2020
with your own controller and handle it however you want (see
2121
:ref:`exception_controller in the Twig reference<config-twig-exception-controller>`);
2222

cookbook/testing/database.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 53 additions & 0 deletions
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 |
@@ -338,6 +340,57 @@ tag its service definition with ``form.type_guesser`` (it has no options).
338340
To see an example of how this class might look, see the ``ValidatorTypeGuesser``
339341
class in the ``Form`` component.
340342
343+
kernel.cache_clearer
344+
--------------------
345+
346+
**Purpose**: Register your service to be called during the cache clearing process
347+
348+
Cache clearing occurs whenever you call ``cache:clear`` command. If your
349+
bundle caches files, you should add custom cache clearer for clearing those
350+
files during the cache clearing process.
351+
352+
In order to register your custom cache clearer, first you must create a
353+
service class::
354+
355+
// src/Acme/MainBundle/Cache/MyClearer.php
356+
namespace Acme\MainBundle\Cache;
357+
358+
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
359+
360+
class MyClearer implements CacheClearerInterface
361+
{
362+
public function clear($cacheDir)
363+
{
364+
// clear your cache
365+
}
366+
367+
}
368+
369+
Then register this class and tag it with ``kernel.cache:clearer``:
370+
371+
.. configuration-block::
372+
373+
.. code-block:: yaml
374+
375+
services:
376+
my_cache_clearer:
377+
class: Acme\MainBundle\Cache\MyClearer
378+
tags:
379+
- { name: kernel.cache_clearer }
380+
381+
.. code-block:: xml
382+
383+
<service id="my_cache_clearer" class="Acme\MainBundle\Cache\MyClearer">
384+
<tag name="kernel.cache_clearer" />
385+
</service>
386+
387+
.. code-block:: php
388+
389+
$container
390+
->register('my_cache_clearer', 'Acme\MainBundle\Cache\MyClearer')
391+
->addTag('kernel.cache_clearer')
392+
;
393+
341394
kernel.cache_warmer
342395
-------------------
343396

0 commit comments

Comments
 (0)