From a9cfdb22229e2c7e853882a446ccca318d05f619 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 aefc36c87986c46faa0e5b2446e31a278af86542 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 97ed5ce27716a263b72eb4064785d38fb344914b 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();