From 0653d95306bad1cb28153b6ba4d1a2e3a6e480b7 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Thu, 27 Jun 2013 12:41:59 +0200 Subject: [PATCH 1/5] Mentioning the include of ocramius/proxy-manager for full-stack framework --- components/dependency_injection/lazy_services.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 88ad0c51f59..240ed227cc4 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -34,9 +34,13 @@ 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 + + "ocramius/proxy-manager": ">=0.3.1,<0.4-dev" + + to your ``composer.json``. Afterwards compile your container and check if you + get a proxy for your lazy services. Configuration ------------- @@ -89,4 +93,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 From 6900cdff14f69192980f745dee0d808a3293e12e Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 10:29:31 +0200 Subject: [PATCH 2/5] Updated to version 0.4.x and added code-block --- components/dependency_injection/lazy_services.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 240ed227cc4..3279c627f56 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -37,7 +37,11 @@ the `ProxyManager bridge`_: 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 - "ocramius/proxy-manager": ">=0.3.1,<0.4-dev" + .. 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. From 82ef8418cca0e5c3784c7f1246f91c673d244a90 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 14:02:02 +0200 Subject: [PATCH 3/5] Added information about how to test if lazy loaded services are working --- components/dependency_injection/lazy_services.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 3279c627f56..a0e8a800b24 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -79,6 +79,14 @@ 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. + + 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 From 152bd795f8f3904cf3def5f8812f4c887fec8a8c Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 14:02:59 +0200 Subject: [PATCH 4/5] Added php code block --- components/dependency_injection/lazy_services.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index a0e8a800b24..3c8cb53f10d 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -82,7 +82,8 @@ injected will be the proxy. To check if your proxy works you can simply check the interface of the received object. - var_dump(class_implements($service)); + .. code-block:: php + var_dump(class_implements($service)); If the class implements the ProxyManager\Proxy\LazyLoadingInterface your lazy loaded services will work as expected. From 516969a2e0759fd306f7b2ec9299d530aa012126 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 15:46:44 +0200 Subject: [PATCH 5/5] Updated formatting --- components/dependency_injection/lazy_services.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 3c8cb53f10d..e0bdbd6c9a5 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -82,10 +82,11 @@ 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)); +.. code-block:: php + + var_dump(class_implements($service)); -If the class implements the ProxyManager\Proxy\LazyLoadingInterface your lazy +If the class implements the "ProxyManager\Proxy\LazyLoadingInterface" your lazy loaded services will work as expected. .. note::