Skip to content

Commit f42a300

Browse files
committed
Merge branch '2.4' into 2.5
* 2.4: Remove redundant references to trusting HttpCache link translation DIC tags to components section fix ContainerAwareEventDispatcher definition
2 parents b50dd72 + fdeab33 commit f42a300

File tree

6 files changed

+20
-44
lines changed

6 files changed

+20
-44
lines changed

book/http_cache.rst

-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,6 @@ kernel::
163163
The caching kernel will immediately act as a reverse proxy - caching responses
164164
from your application and returning them to the client.
165165

166-
Now that you're using a "proxy", you'll need to configure ``127.0.0.1`` under
167-
the ``trusted_proxies`` configuration (see :ref:`the reference <reference-framework-trusted-proxies>`).
168-
Without this, the client's IP address and a few other things won't report correctly.
169-
170166
.. tip::
171167

172168
The cache kernel has a special ``getLog()`` method that returns a string

components/event_dispatcher/introduction.rst

+7-4
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ instance of ``Symfony\Component\HttpKernel\Event\FilterResponseEvent``::
208208
.. sidebar:: Registering Event Listeners in the Service Container
209209

210210
When you are using the
211+
:class:`Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher`
212+
and the
211213
:doc:`DependencyInjection component </components/dependency_injection/introduction>`,
212214
you can use the
213215
:class:`Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterListenersPass`
@@ -216,16 +218,17 @@ instance of ``Symfony\Component\HttpKernel\Event\FilterResponseEvent``::
216218
use Symfony\Component\DependencyInjection\ContainerBuilder;
217219
use Symfony\Component\DependencyInjection\Definition;
218220
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
221+
use Symfony\Component\DependencyInjection\Reference;
219222
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
220223

221224
$containerBuilder = new ContainerBuilder(new ParameterBag());
222225
$containerBuilder->addCompilerPass(new RegisterListenersPass());
223226

224227
// register the event dispatcher service
225-
$containerBuilder->register(
226-
'event_dispatcher',
227-
'Symfony\Component\EventDispatcher\EventDispatcher'
228-
);
228+
$containerBuilder->setDefinition('event_dispatcher', new Definition(
229+
'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher',
230+
array(new Reference('service_container'))
231+
));
229232

230233
// register your event listener service
231234
$listener = new Definition('AcmeListener');

components/http_foundation/trusting_proxies.rst

-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ your proxy.
3030
// only trust proxy headers coming from this IP addresses
3131
Request::setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));
3232
33-
.. note::
34-
35-
When using Symfony's internal reverse proxy (``AppCache.php``) make sure to add
36-
``127.0.0.1`` to the list of trusted proxies.
37-
38-
3933
Configuring Header Names
4034
------------------------
4135

components/translation/custom_formats.rst

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ message. A translation file would look like this:
1818
(goodbye)(au revoir)
1919
(hello)(bonjour)
2020
21+
.. _components-translation-custom-loader:
22+
2123
Creating a Custom Loader
2224
------------------------
2325

@@ -65,6 +67,8 @@ Once created, it can be used as any other loader::
6567

6668
It will print *"accueil"*.
6769

70+
.. _components-translation-custom-dumper:
71+
6872
Creating a Custom Dumper
6973
------------------------
7074

cookbook/request/load_balancer_reverse_proxy.rst

-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ special ``X-Forwarded-*`` headers. For example, instead of reading the ``REMOTE_
1111
header (which will now be the IP address of your reverse proxy), the user's
1212
true IP will be stored in an ``X-Forwarded-For`` header.
1313

14-
.. tip::
15-
16-
If you're using Symfony's :ref:`AppCache<symfony-gateway-cache>` for caching,
17-
then you *are* using a reverse proxy with the IP address ``127.0.0.1``.
18-
You'll need to configure that address as a trusted proxy below.
19-
2014
If you don't configure Symfony to look for these headers, you'll get incorrect
2115
information about the client's IP address, whether or not the client is connecting
2216
via HTTPS, the client's port and the hostname being requested.

reference/dic_tags.rst

+9-24
Original file line numberDiff line numberDiff line change
@@ -1040,32 +1040,12 @@ translation.loader
10401040
**Purpose**: To register a custom service that loads translations
10411041
10421042
By default, translations are loaded from the filesystem in a variety of different
1043-
formats (YAML, XLIFF, PHP, etc). If you need to load translations from some
1044-
other source, first create a class that implements the
1045-
:class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface::
1043+
formats (YAML, XLIFF, PHP, etc).
10461044
1047-
// src/Acme/MainBundle/Translation/MyCustomLoader.php
1048-
namespace Acme\MainBundle\Translation;
1049-
1050-
use Symfony\Component\Translation\Loader\LoaderInterface;
1051-
use Symfony\Component\Translation\MessageCatalogue;
1052-
1053-
class MyCustomLoader implements LoaderInterface
1054-
{
1055-
public function load($resource, $locale, $domain = 'messages')
1056-
{
1057-
$catalogue = new MessageCatalogue($locale);
1058-
1059-
// some how load up some translations from the "resource"
1060-
// then set them into the catalogue
1061-
$catalogue->set('hello.world', 'Hello World!', $domain);
1062-
1063-
return $catalogue;
1064-
}
1065-
}
1045+
.. seealso::
10661046
1067-
Your custom loader's ``load`` method is responsible for returning a
1068-
:Class:`Symfony\\Component\\Translation\\MessageCatalogue`.
1047+
Learn how to :ref:`load custom formats <components-translation-custom-loader>`
1048+
in the components section.
10691049
10701050
Now, register your loader as a service and tag it with ``translation.loader``:
10711051
@@ -1257,6 +1237,11 @@ This is the name that's used to determine which dumper should be used.
12571237
)
12581238
->addTag('translation.dumper', array('alias' => 'json'));
12591239
1240+
.. seealso::
1241+
1242+
Learn how to :ref:`dump to custom formats <components-translation-custom-dumper>`
1243+
in the components section.
1244+
12601245
.. _reference-dic-tags-twig-extension:
12611246
12621247
twig.extension

0 commit comments

Comments
 (0)