diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-09 13:43:06 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-09 13:43:06 -0600 |
commit | 84284a9ccee7d5ccc658c3d1f751a5254b3b9175 (patch) | |
tree | 7188b647d6b631428e870a3975210960f05e6974 /phpBB | |
parent | 357a4facf6a5b026c507b54dc8c35b20207e80e0 (diff) | |
download | forums-84284a9ccee7d5ccc658c3d1f751a5254b3b9175.tar forums-84284a9ccee7d5ccc658c3d1f751a5254b3b9175.tar.gz forums-84284a9ccee7d5ccc658c3d1f751a5254b3b9175.tar.bz2 forums-84284a9ccee7d5ccc658c3d1f751a5254b3b9175.tar.xz forums-84284a9ccee7d5ccc658c3d1f751a5254b3b9175.zip |
[ticket/11103] Use scope: prototype
This lets us clean up the mess that was in load_object(), but requires
scope: prototype to be added to the service definitions for all types
or methods!
PHPBB3-11103
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/config/notifications.yml | 17 | ||||
-rw-r--r-- | phpBB/includes/notification/manager.php | 20 |
2 files changed, 18 insertions, 19 deletions
diff --git a/phpBB/config/notifications.yml b/phpBB/config/notifications.yml index 5a593c44d6..550fbdfd0c 100644 --- a/phpBB/config/notifications.yml +++ b/phpBB/config/notifications.yml @@ -15,6 +15,7 @@ services: notification.type.approve_post: class: phpbb_notification_type_approve_post + scope: prototype # scope MUST be prototype for this to work! # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -31,6 +32,7 @@ services: notification.type.approve_topic: class: phpbb_notification_type_approve_topic + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -47,6 +49,7 @@ services: notification.type.bookmark: class: phpbb_notification_type_bookmark + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -63,6 +66,7 @@ services: notification.type.disapprove_post: class: phpbb_notification_type_disapprove_post + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -79,6 +83,7 @@ services: notification.type.disapprove_topic: class: phpbb_notification_type_disapprove_topic + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -95,6 +100,7 @@ services: notification.type.pm: class: phpbb_notification_type_pm + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -111,6 +117,7 @@ services: notification.type.post: class: phpbb_notification_type_post + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -127,6 +134,7 @@ services: notification.type.post_in_queue: class: phpbb_notification_type_post_in_queue + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -143,6 +151,7 @@ services: notification.type.quote: class: phpbb_notification_type_quote + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -159,6 +168,7 @@ services: notification.type.report_pm: class: phpbb_notification_type_report_pm + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -175,6 +185,7 @@ services: notification.type.report_pm_closed: class: phpbb_notification_type_report_pm_closed + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -191,6 +202,7 @@ services: notification.type.report_post: class: phpbb_notification_type_report_post + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -207,6 +219,7 @@ services: notification.type.report_post_closed: class: phpbb_notification_type_report_post + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -223,6 +236,7 @@ services: notification.type.topic: class: phpbb_notification_type_topic + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -239,6 +253,7 @@ services: notification.type.topic_in_queue: class: phpbb_notification_type_topic_in_queue + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -255,6 +270,7 @@ services: notification.method.email: class: phpbb_notification_method_email + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn @@ -269,6 +285,7 @@ services: notification.method.jabber: class: phpbb_notification_method_jabber + scope: prototype # scope MUST be prototype for this to work! arguments: - @user_loader - @dbal.conn diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php index 4c25fa72f0..22f8f58783 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/includes/notification/manager.php @@ -779,24 +779,6 @@ class phpbb_notification_manager */ protected function load_object($object_name) { - // Here we cannot just use ContainerBuilder->get(name) - // The reason for this is because get handles services - // which are initialized once and shared. Here we need - // separate new objects because we pass around objects - // that store row data in each object, which would lead - // to over-writing of data if we used get() - - $parameterBag = $this->phpbb_container->getParameterBag(); - $definition = $this->phpbb_container->getDefinition($object_name); - $arguments = $this->phpbb_container->resolveServices( - $parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())) - ); - $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass())); - - $object = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); - - $object->set_notification_manager($this); - - return $object; + return $this->phpbb_container->get($object_name); } } |