[FEATURE] Add ObjectManager->getScope like in TYPO3.Flow
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Object / Container / Container.php
index 17553a0..e30a8e7 100644 (file)
@@ -36,6 +36,9 @@ namespace TYPO3\CMS\Extbase\Object\Container;
  */
 class Container implements \TYPO3\CMS\Core\SingletonInterface {
 
+       const SCOPE_PROTOTYPE = 1;
+       const SCOPE_SINGLETON = 2;
+
        /**
         * internal cache for classinfos
         *
@@ -327,6 +330,24 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface {
                }
                return $classInfo;
        }
+
+       /**
+        * @param string $className
+        *
+        * @return boolean
+        */
+       public function isSingleton($className) {
+               return $this->getClassInfo($className)->getIsSingleton();
+       }
+
+       /**
+        * @param string $className
+        *
+        * @return boolean
+        */
+       public function isPrototype($className) {
+               return !$this->isSingleton($className);
+       }
 }
 
 ?>
\ No newline at end of file