Skip to content

Commit

Permalink
Merge branch '2.4' into 2.5
Browse files Browse the repository at this point in the history
* 2.4:
  Remove redundant references to trusting HttpCache
  link translation DIC tags to components section
  fix ContainerAwareEventDispatcher definition
  • Loading branch information
weaverryan committed Sep 22, 2014
2 parents b50dd72 + fdeab33 commit f42a300
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 44 deletions.
4 changes: 0 additions & 4 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ kernel::
The caching kernel will immediately act as a reverse proxy - caching responses
from your application and returning them to the client.

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

.. tip::

The cache kernel has a special ``getLog()`` method that returns a string
Expand Down
11 changes: 7 additions & 4 deletions components/event_dispatcher/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ instance of ``Symfony\Component\HttpKernel\Event\FilterResponseEvent``::
.. sidebar:: Registering Event Listeners in the Service Container

When you are using the
:class:`Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher`
and the
:doc:`DependencyInjection component </components/dependency_injection/introduction>`,
you can use the
:class:`Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterListenersPass`
Expand All @@ -216,16 +218,17 @@ instance of ``Symfony\Component\HttpKernel\Event\FilterResponseEvent``::
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;

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

// register the event dispatcher service
$containerBuilder->register(
'event_dispatcher',
'Symfony\Component\EventDispatcher\EventDispatcher'
);
$containerBuilder->setDefinition('event_dispatcher', new Definition(
'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher',
array(new Reference('service_container'))
));

// register your event listener service
$listener = new Definition('AcmeListener');
Expand Down
6 changes: 0 additions & 6 deletions components/http_foundation/trusting_proxies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ your proxy.
// only trust proxy headers coming from this IP addresses
Request::setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));
.. note::

When using Symfony's internal reverse proxy (``AppCache.php``) make sure to add
``127.0.0.1`` to the list of trusted proxies.


Configuring Header Names
------------------------

Expand Down
4 changes: 4 additions & 0 deletions components/translation/custom_formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ message. A translation file would look like this:
(goodbye)(au revoir)
(hello)(bonjour)
.. _components-translation-custom-loader:

Creating a Custom Loader
------------------------

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

It will print *"accueil"*.

.. _components-translation-custom-dumper:

Creating a Custom Dumper
------------------------

Expand Down
6 changes: 0 additions & 6 deletions cookbook/request/load_balancer_reverse_proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ special ``X-Forwarded-*`` headers. For example, instead of reading the ``REMOTE_
header (which will now be the IP address of your reverse proxy), the user's
true IP will be stored in an ``X-Forwarded-For`` header.

.. tip::

If you're using Symfony's :ref:`AppCache<symfony-gateway-cache>` for caching,
then you *are* using a reverse proxy with the IP address ``127.0.0.1``.
You'll need to configure that address as a trusted proxy below.

If you don't configure Symfony to look for these headers, you'll get incorrect
information about the client's IP address, whether or not the client is connecting
via HTTPS, the client's port and the hostname being requested.
Expand Down
33 changes: 9 additions & 24 deletions reference/dic_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1040,32 +1040,12 @@ translation.loader
**Purpose**: To register a custom service that loads translations
By default, translations are loaded from the filesystem in a variety of different
formats (YAML, XLIFF, PHP, etc). If you need to load translations from some
other source, first create a class that implements the
:class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface::
formats (YAML, XLIFF, PHP, etc).
// src/Acme/MainBundle/Translation/MyCustomLoader.php
namespace Acme\MainBundle\Translation;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\MessageCatalogue;
class MyCustomLoader implements LoaderInterface
{
public function load($resource, $locale, $domain = 'messages')
{
$catalogue = new MessageCatalogue($locale);
// some how load up some translations from the "resource"
// then set them into the catalogue
$catalogue->set('hello.world', 'Hello World!', $domain);
return $catalogue;
}
}
.. seealso::
Your custom loader's ``load`` method is responsible for returning a
:Class:`Symfony\\Component\\Translation\\MessageCatalogue`.
Learn how to :ref:`load custom formats <components-translation-custom-loader>`
in the components section.
Now, register your loader as a service and tag it with ``translation.loader``:
Expand Down Expand Up @@ -1257,6 +1237,11 @@ This is the name that's used to determine which dumper should be used.
)
->addTag('translation.dumper', array('alias' => 'json'));
.. seealso::
Learn how to :ref:`dump to custom formats <components-translation-custom-dumper>`
in the components section.
.. _reference-dic-tags-twig-extension:
twig.extension
Expand Down

0 comments on commit f42a300

Please sign in to comment.