[+BUGFIX] Make ObjectManager::isRegistered work
authorSebastian Kurfuerst <sebastian@typo3.org>
Mon, 20 Jun 2011 08:56:40 +0000 (10:56 +0200)
committerSebastian Kurfuerst <sebastian@typo3.org>
Mon, 20 Jun 2011 08:56:40 +0000 (10:56 +0200)
This is a followup change to I7a31f93e9855bb1e36c5953e86c3aef7322f548f,
which introduced several unwanted behaviors, the main problem being that
isRegistered would not work for all objects being created implicitely through
dependency injection.

Furthermore, the change removes the @api annotations again, after discussing
that with Bastian, we do not see a benefit in providing that to the user right now.

Change-Id: Ibe4221c288daf9b10cc3f0decaa33bfccb5f9430

typo3/sysext/extbase/Classes/Object/ObjectManager.php
typo3/sysext/extbase/Classes/Object/ObjectManagerInterface.php

index 3c7e159..8a4957a 100644 (file)
@@ -39,11 +39,6 @@ class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManager
        protected $objectContainer;
 
        /**
-        * @var array
-        */
-       protected $objects = array();
-
-       /**
         * Constructs a new Object Manager
         */
        public function __construct() {
@@ -55,15 +50,9 @@ class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManager
         *
         * @param  string $objectName Name of the object
         * @return boolean TRUE if the object has been registered, otherwise FALSE
-        * @author Robert Lemke <robert@typo3.org>
-        * @api
         */
        public function isRegistered($objectName) {
-               if (isset($this->objects[$objectName])) {
-                       return TRUE;
-               }
-
-               return FALSE;
+               return class_exists($objectName, TRUE);
        }
 
        /**
@@ -82,9 +71,7 @@ class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManager
        public function get($objectName) {
                $arguments = func_get_args();
                array_shift($arguments);
-               $this->objects[$objectName]['i'] = $this->objectContainer->getInstance($objectName, $arguments);
-
-               return $this->objects[$objectName]['i'];
+               return $this->objectContainer->getInstance($objectName, $arguments);
        }
 
        /**
index f7416f6..f85b189 100644 (file)
@@ -38,7 +38,6 @@ interface Tx_Extbase_Object_ObjectManagerInterface extends t3lib_Singleton {
         *
         * @param  string $objectName Name of the object
         * @return boolean TRUE if the object has been registered, otherwise FALSE
-        * @api
         */
        public function isRegistered($objectName);