diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 88ad0c51f59..e0bdbd6c9a5 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -34,9 +34,17 @@ the `ProxyManager bridge`_: .. note:: - If you're using the full-stack framework, this package is not included - and needs to be added to ``composer.json`` and installed (which is what - the above command does). + If you're using the full-stack framework, the proxy manager bridge is already + included but the actual proxy manager needs to be included. Therefore add + + .. code-block:: json + + "require": { + "ocramius/proxy-manager": "0.4.*" + } + + to your ``composer.json``. Afterwards compile your container and check if you + get a proxy for your lazy services. Configuration ------------- @@ -71,6 +79,16 @@ the same signature of the class representing the service. You can also inject the service just like normal into other services. The object that's actually injected will be the proxy. +To check if your proxy works you can simply check the interface of the +received object. + +.. code-block:: php + + var_dump(class_implements($service)); + +If the class implements the "ProxyManager\Proxy\LazyLoadingInterface" your lazy +loaded services will work as expected. + .. note:: If you don't install the `ProxyManager bridge`_, the container will just @@ -89,4 +107,4 @@ in the `documentation of ProxyManager`_. .. _`ProxyManager bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/ProxyManager .. _`proxy`: http://en.wikipedia.org/wiki/Proxy_pattern -.. _`documentation of ProxyManager`: https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-value-holder.md \ No newline at end of file +.. _`documentation of ProxyManager`: https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-value-holder.md