From 475eff9d03cc33d284e629a8a430fd23a4593a94 Mon Sep 17 00:00:00 2001 From: AlaaAttya Date: Mon, 7 Apr 2014 15:12:22 +0200 Subject: [PATCH 1/3] Update factories.rst your factory method should be static to work! --- components/dependency_injection/factories.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dependency_injection/factories.rst b/components/dependency_injection/factories.rst index f156d7a8fab..9561b621c48 100644 --- a/components/dependency_injection/factories.rst +++ b/components/dependency_injection/factories.rst @@ -17,7 +17,7 @@ object:: class NewsletterFactory { - public function get() + public static function get() { $newsletterManager = new NewsletterManager(); From 8dd5e8b430fc0efd06da2ac7a3d07bb30b67a14a Mon Sep 17 00:00:00 2001 From: AlaaAttya Date: Sun, 13 Apr 2014 11:54:52 +0200 Subject: [PATCH 2/3] Update factories.rst --- components/dependency_injection/factories.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dependency_injection/factories.rst b/components/dependency_injection/factories.rst index 9561b621c48..d77c701b880 100644 --- a/components/dependency_injection/factories.rst +++ b/components/dependency_injection/factories.rst @@ -79,8 +79,8 @@ class: When you specify the class to use for the factory (via ``factory_class``) the method will be called statically. If the factory itself should be instantiated -and the resulting object's method called (as in this example), configure the -factory itself as a service: +and the resulting object's method called, configure the factory itself as a service. +In this case, the method (e.g. get) should be changed to be non-static: .. configuration-block:: From c818065231dd11854396f70fdd148d2c30eff414 Mon Sep 17 00:00:00 2001 From: AlaaAttya Date: Sun, 13 Apr 2014 11:55:25 +0200 Subject: [PATCH 3/3] Update factories.rst --- components/dependency_injection/factories.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dependency_injection/factories.rst b/components/dependency_injection/factories.rst index d77c701b880..96df6429244 100644 --- a/components/dependency_injection/factories.rst +++ b/components/dependency_injection/factories.rst @@ -17,7 +17,7 @@ object:: class NewsletterFactory { - public static function get() + public function get() { $newsletterManager = new NewsletterManager();