symfony/symfony — pull request #7707 by beberlei (2013-04-18 08:40:35+00:00)
Title: [WIP] GH-7007: Synchronized Service alternative, backwards compatible.

Prototype for introducing a ``RequestContext`` in HttpKernel.

This PR keeps the synchronized services feature, however introduces a ``RequestContext`` object additionally, that allows to avoid using synchronized service when injecting ``request_context`` instead of ``request`` into a service. The FrameworkBundle is modified such that it does not depend on synchronized services anymore. Users however can still depend on ``request``, activating the synchronized services feature.

Changes to my previous Gist:

* Renamed ``RequestRegistry`` to ``RequestContext`` as this seems more appropriate, however this creates a clash with ``RequestContext`` in router, so this is open for discussion.
* No events anymore in ``RequestStack``, making this much more leightweight
* Changed listeners that were synchronized before to using ``onKernelResponse`` and ``RequestContext`` to reset to the parent request.
* ``RequestStack`` is injected into the ``ContainerAwareHttpKernel`` although it could already work with just the ``HttpKernel``. That has the constructor tagged with ``@api`` though.

Todos:
* Tests for the Stack + Context objects
* FragmentListener is still synchronized service