From 84284a9ccee7d5ccc658c3d1f751a5254b3b9175 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 9 Dec 2012 13:43:06 -0600 Subject: [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 --- phpBB/includes/notification/manager.php | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'phpBB/includes/notification/manager.php') 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); } } -- cgit v1.2.1