[+BUGFIX] Extbase (Object): Refactor Object Manager
authorSebastian Kurfürst <sebastian@typo3.org>
Tue, 2 Nov 2010 13:23:07 +0000 (13:23 +0000)
committerSebastian Kurfürst <sebastian@typo3.org>
Tue, 2 Nov 2010 13:23:07 +0000 (13:23 +0000)
The Object Manager is now at the same location and
has the same API as in FLOW3.

[+BUGFIX] Extbase: Major cleanups to Dependency Injection and Persistence

Now, DI finally works with Persistence, cleaning
this greatly up. Additionally, all internal
t3lib_div::makeInstance calls have been replaced.
Now, dependency injection is actually usable.

Additionally, we completely thought over which
persistence classes need to be singleton and which
should be prototype, leading finally to a
coherent design in the persistence layer.

[+BUGFIX] Extbase: remove non-used interfaces

Removed classes which were not used.

Relates to: #9062
Resolves: #10585
Resolves: #10564

37 files changed:
typo3/sysext/extbase/Classes/Dispatcher.php
typo3/sysext/extbase/Classes/MVC/Controller/AbstractController.php
typo3/sysext/extbase/Classes/MVC/Controller/ActionController.php
typo3/sysext/extbase/Classes/MVC/Controller/Argument.php
typo3/sysext/extbase/Classes/MVC/Controller/Arguments.php
typo3/sysext/extbase/Classes/MVC/Controller/ArgumentsValidator.php
typo3/sysext/extbase/Classes/MVC/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/MVC/Web/Routing/UriBuilder.php
typo3/sysext/extbase/Classes/Object/Exception/WrongScope.php
typo3/sysext/extbase/Classes/Object/Manager.php [deleted file]
typo3/sysext/extbase/Classes/Object/ManagerInterface.php [deleted file]
typo3/sysext/extbase/Classes/Object/ObjectManager.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/ObjectManagerInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/RegistryInterface.php [deleted file]
typo3/sysext/extbase/Classes/Object/TransientRegistry.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Backend.php
typo3/sysext/extbase/Classes/Persistence/IdentityMap.php
typo3/sysext/extbase/Classes/Persistence/LazyLoadingProxy.php
typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php
typo3/sysext/extbase/Classes/Persistence/Manager.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapFactory.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactory.php
typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactoryInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Query.php
typo3/sysext/extbase/Classes/Persistence/QueryFactory.php
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Property/Mapper.php
typo3/sysext/extbase/Classes/Security/Channel/RequestHashService.php
typo3/sysext/extbase/Classes/Validation/Validator/AbstractValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/GenericObjectValidator.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php
typo3/sysext/extbase/Tests/BaseTestCase.php
typo3/sysext/extbase/Tests/MVC/Controller/ActionController_testcase.php
typo3/sysext/extbase/Tests/Validation/ValidatorResolver_testcase.php
typo3/sysext/extbase/ext_autoload.php
typo3/sysext/extbase/ext_localconf.php

index 9df7762..4d637cd 100644 (file)
@@ -73,7 +73,7 @@ class Tx_Extbase_Dispatcher {
        protected static $extbaseFrameworkConfiguration;
 
        /**
-        * @var Tx_Extbase_Object_Manager
+        * @var Tx_Extbase_Object_ObjectManager
         */
        protected $objectManager;
 
@@ -200,7 +200,7 @@ class Tx_Extbase_Dispatcher {
         * @return void
         */
        protected function initializeObjectManager() {
-               $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_Manager');
+               $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
        }
 
        /**
index 98f8439..781a1ee 100644 (file)
@@ -35,7 +35,7 @@
  */
 abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbase_MVC_Controller_ControllerInterface {
        /**
-        * @var Tx_Extbase_Object_ManagerInterface
+        * @var Tx_Extbase_Object_ObjectManagerInterface
         */
        protected $objectManager;
 
@@ -124,14 +124,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
         */
        public function __construct() {
                list(, $this->extensionName) = explode('_', get_class($this));
-       }
 
-       /**
-        * @param Tx_Extbase_MVC_Controller_Arguments $arguments
-        * @return void
-        */
-       public function injectArguments(Tx_Extbase_MVC_Controller_Arguments $arguments) {
-               $this->arguments = $arguments;
        }
 
        /**
@@ -157,11 +150,12 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
        /**
         * Injects the object manager
         *
-        * @param Tx_Extbase_Object_ManagerInterface $objectManager
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
         * @return void
         */
-       public function injectObjectManager(Tx_Extbase_Object_ManagerInterface $objectManager) {
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
+               $this->arguments = $this->objectManager->create('Tx_Extbase_MVC_Controller_Arguments');
        }
 
        /**
@@ -219,7 +213,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
                $this->request->setDispatched(TRUE);
                $this->response = $response;
 
-               $this->uriBuilder = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Routing_UriBuilder');
+               $this->uriBuilder = $this->objectManager->create('Tx_Extbase_MVC_Web_Routing_UriBuilder');
                $this->uriBuilder->setRequest($request);
 
                $this->initializeControllerArgumentsBaseValidators();
@@ -233,7 +227,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
         * @api
         */
        protected function buildControllerContext() {
-               $controllerContext = t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_ControllerContext');
+               $controllerContext = $this->objectManager->create('Tx_Extbase_MVC_Controller_ControllerContext');
                $controllerContext->setRequest($this->request);
                $controllerContext->setResponse($this->response);
                if ($this->arguments !== NULL) {
@@ -382,7 +376,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
                        if ($this->arguments[$propertyName]->isRequired() === FALSE) $optionalPropertyNames[] = $propertyName;
                }
 
-               $validator = t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_ArgumentsValidator');
+               $validator = $this->objectManager->create('Tx_Extbase_MVC_Controller_ArgumentsValidator');
                $this->propertyMapper->mapAndValidate($allPropertyNames, $this->request->getArguments(), $this->arguments, $optionalPropertyNames, $validator);
 
                $this->argumentsMappingResults = $this->propertyMapper->getMappingResults();
index e253248..6b257e0 100644 (file)
@@ -119,7 +119,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
                $this->request->setDispatched(TRUE);
                $this->response = $response;
 
-               $this->uriBuilder = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Routing_UriBuilder');
+               $this->uriBuilder = $this->objectManager->create('Tx_Extbase_MVC_Web_Routing_UriBuilder');
                $this->uriBuilder->setRequest($request);
 
                $this->actionMethodName = $this->resolveActionMethodName();
@@ -252,7 +252,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
         * @api
         */
        protected function resolveView() {
-               $view = $this->objectManager->getObject('Tx_Fluid_View_TemplateView');
+               $view = $this->objectManager->create('Tx_Fluid_View_TemplateView');
                $controllerContext = $this->buildControllerContext();
                $view->setControllerContext($controllerContext);
 
@@ -271,7 +271,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
                if ($view->hasTemplate() === FALSE) {
                        $viewObjectName = $this->resolveViewObjectName();
                        if (class_exists($viewObjectName) === FALSE) $viewObjectName = 'Tx_Extbase_MVC_View_EmptyView';
-                       $view = $this->objectManager->getObject($viewObjectName);
+                       $view = $this->objectManager->create($viewObjectName);
                        $view->setControllerContext($controllerContext);
                }
                if (method_exists($view, 'injectSettings')) {
index 70817e4..bfbcaeb 100644 (file)
 class Tx_Extbase_MVC_Controller_Argument {
 
        /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
         * @var Tx_Extbase_Persistence_QueryFactory
         */
        protected $queryFactory;
@@ -134,14 +139,29 @@ class Tx_Extbase_MVC_Controller_Argument {
        }
 
        /**
-        * Initializes this object
+        * Injects the object manager
         *
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * @param Tx_Extbase_Property_Mapper $propertyMapper
+        * @return void
+        */
+       public function injectPropertyMapper(Tx_Extbase_Property_Mapper $propertyMapper) {
+               $this->propertyMapper = $propertyMapper;
+       }
+
+       /**
+        * @param Tx_Extbase_Reflection_Service $reflectionService 
         * @return void
         */
-       public function initializeObject() {
-               $this->reflectionService = t3lib_div::makeInstance('Tx_Extbase_Reflection_Service');
-               $this->propertyMapper = t3lib_div::makeInstance('Tx_Extbase_Property_Mapper');
-               $this->propertyMapper->injectReflectionService($this->reflectionService);
+       public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
+               $this->reflectionService = $reflectionService;
                $this->dataTypeClassSchema = (strstr($this->dataType, '_') !== FALSE) ? $this->reflectionService->getClassSchema($this->dataType) : NULL;
        }
 
@@ -286,11 +306,11 @@ class Tx_Extbase_MVC_Controller_Argument {
         */
        public function setNewValidatorConjunction(array $objectNames) {
                if ($this->validator === NULL) {
-                       $this->validator = t3lib_div::makeInstance('Tx_Extbase_Validation_Validator_ConjunctionValidator');
+                       $this->validator = $this->objectManager->create('Tx_Extbase_Validation_Validator_ConjunctionValidator');
                }
                foreach ($objectNames as $objectName) {
                        if (!class_exists($objectName)) $objectName = 'Tx_Extbase_Validation_Validator_' . $objectName;
-                       $this->validator->addValidator(t3lib_div::makeInstance($objectName));
+                       $this->validator->addValidator($this->objectManager->get($objectName));
                }
                return $this;
        }
index b9e0f54..f9e4998 100644 (file)
  * @scope prototype
  */
 class Tx_Extbase_MVC_Controller_Arguments extends ArrayObject {
-
-       /**
-        * @var Tx_Extbase_Persistence_ManagerInterface
-        */
-       protected $persistenceManager;
-
        /**
-        * @var Tx_Extbase_Persistence_QueryFactoryInterface
+        * @var Tx_Extbase_Object_ObjectManagerInterface
         */
-       protected $queryFactory;
+       protected $objectManager;
 
        /**
         * @var array Names of the arguments contained by this object
@@ -51,23 +45,20 @@ class Tx_Extbase_MVC_Controller_Arguments extends ArrayObject {
        protected $argumentNames = array();
 
        /**
-        * Injects the persistence manager
-        *
-        * @param Tx_Extbase_Persistence_ManagerInterface $persistenceManager
-        * @return void
+        * Constructor. If this one is removed, reflection breaks.
         */
-       public function injectPersistenceManager(Tx_Extbase_Persistence_ManagerInterface $persistenceManager) {
-               $this->persistenceManager = $persistenceManager;
+       public function __construct() {
+               parent::__construct();
        }
 
        /**
-        * Injects a QueryFactory instance
+        * Injects the object manager
         *
-        * @param Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
         * @return void
         */
-       public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory) {
-               $this->queryFactory = $queryFactory;
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
        }
 
        /**
@@ -151,27 +142,12 @@ class Tx_Extbase_MVC_Controller_Arguments extends ArrayObject {
         * @return Tx_Extbase_MVC_Controller_Argument The new argument
         */
        public function addNewArgument($name, $dataType = 'Text', $isRequired = FALSE, $defaultValue = NULL) {
-               $argument = $this->createArgument($name, $dataType);
+               $argument = $this->objectManager->create('Tx_Extbase_MVC_Controller_Argument', $name, $dataType);
                $argument->setRequired($isRequired);
                $argument->setDefaultValue($defaultValue);
                $this->addArgument($argument);
                return $argument;
        }
-       
-       /**
-        * Creates a new argument. This is a replacement for $this->objectFactory->create() of FLOW3.
-        *
-        * @param string $name Name of the argument
-        * @param string $dataType Name of one of the built-in data types
-        * @return Tx_Extbase_MVC_Controller_Argument The created argument
-        */
-       protected function createArgument($name, $dataType) {
-               $argument = new Tx_Extbase_MVC_Controller_Argument($name, $dataType);
-               $argument->injectPersistenceManager($this->persistenceManager);
-               $argument->injectQueryFactory($this->queryFactory);
-               $argument->initializeObject();
-               return $argument;
-       }
 
        /**
         * Adds the specified controller argument to this composite object.
index 847c7a9..d2bbea7 100644 (file)
@@ -105,7 +105,7 @@ class Tx_Extbase_MVC_Controller_ArgumentsValidator extends Tx_Extbase_Validation
         */
        protected function addErrorsForArgument(array $errors, $argumentName) {
                if (!isset($this->errors[$argumentName])) {
-                       $this->errors[$argumentName] = t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_ArgumentError', $argumentName);
+                       $this->errors[$argumentName] = new Tx_Extbase_MVC_Controller_ArgumentError($argumentName);
                }
                $this->errors[$argumentName]->addErrors($errors);
        }
index 0f619ed..07ddb31 100644 (file)
@@ -36,7 +36,7 @@
  */
 class Tx_Extbase_MVC_Web_RequestBuilder {
        /**
-        * @var Tx_Extbase_Object_ManagerInterface
+        * @var Tx_Extbase_Object_ObjectManagerInterface
         */
        protected $objectManager;
 
@@ -109,10 +109,10 @@ class Tx_Extbase_MVC_Web_RequestBuilder {
        /**
         * Injects the object manager
         *
-        * @param Tx_Extbase_Object_ManagerInterface $objectManager
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
         * @return void
         */
-       public function injectObjectManager(Tx_Extbase_Object_ManagerInterface $objectManager) {
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
        }
 
@@ -139,7 +139,7 @@ class Tx_Extbase_MVC_Web_RequestBuilder {
                        $actionName = $this->defaultActionName;
                }
 
-               $request = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Request');
+               $request = $this->objectManager->create('Tx_Extbase_MVC_Web_Request');
                $request->setPluginName($this->pluginName);
                $request->setControllerExtensionName($this->extensionName);
                $request->setControllerName($controllerName);
index f95216d..3e31ee5 100644 (file)
@@ -97,11 +97,9 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder {
 
        /**
         * Constructs this URI Helper
-        *
-        * @param tslib_cObj $contentObject
         */
-       public function __construct(tslib_cObj $contentObject = NULL) {
-               $this->contentObject = $contentObject !== NULL ? $contentObject : t3lib_div::makeInstance('tslib_cObj');
+       public function __construct() {
+               $this->contentObject = t3lib_div::makeInstance('tslib_cObj');
        }
 
        /**
index 3feeefe..43f8a0b 100644 (file)
@@ -32,7 +32,7 @@
  * @subpackage Object\Exception
  * @version $Id$
  */
-class Tx_Extbase_Object_WrongScope extends Tx_Extbase_Object_Exception {
+class Tx_Extbase_Object_Exception_WrongScope extends Tx_Extbase_Object_Exception {
 
 }
 
diff --git a/typo3/sysext/extbase/Classes/Object/Manager.php b/typo3/sysext/extbase/Classes/Object/Manager.php
deleted file mode 100644 (file)
index 849bef1..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Implementation of the default Extbase Object Manager
- *
- * @package Extbase
- * @subpackage Object
- * @version $Id$
- */
-class Tx_Extbase_Object_Manager implements Tx_Extbase_Object_ManagerInterface, t3lib_Singleton {
-
-       /**
-        * @var Tx_Container_Container
-        */
-       protected $objectContainer;
-
-       /**
-        * Constructs a new Object Manager
-        */
-       public function __construct() {
-               $this->objectContainer = Tx_Container_Container::getContainer();
-       }
-
-       /**
-        * @param string $objectName The name of the object to return an instance of
-        * @return object The object instance
-        * @deprecated since 1.3.0, will be removed in 1.5.0
-        */
-       public function getObject($objectName) {
-               return $this->get($objectName);
-       }
-
-       /**
-        * Returns a fresh or existing instance of the object specified by $objectName.
-        *
-        * @param string $objectName The name of the object to return an instance of
-        * @return object The object instance
-        * @api
-        */
-       public function get($objectName) {
-               return call_user_func_array(array($this->objectContainer, 'getInstance'), func_get_args());
-       }
-
-       /**
-        * Registers a classname that should be used to resolve a given interface.
-        *
-        * Per default the interface's name stripped of "Interface" will be used.
-        * @param string $className
-        * @param string $alternativeClassName
-        */
-       static public function registerImplementation($className, $alternativeClassName) {
-               return Tx_Container_Container::getContainer()->registerImplementation($className, $alternativeClassName);
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/ManagerInterface.php b/typo3/sysext/extbase/Classes/Object/ManagerInterface.php
deleted file mode 100644 (file)
index 1014db4..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Interface for the TYPO3 Object Manager
- *
- * @package Extbase
- * @subpackage Object
- * @version $Id$
- */
-interface Tx_Extbase_Object_ManagerInterface {
-
-       /**
-        * Returns a fresh or existing instance of the object specified by $objectName.
-        *
-        * Important:
-        *
-        * If possible, instances of Prototype objects should always be created with the
-        * Object Factory's create() method and Singleton objects should rather be
-        * injected by some type of Dependency Injection.
-        *
-        * @param string $objectName The name of the object to return an instance of
-        * @return object The object instance
-        */
-       public function getObject($objectName);
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/ObjectManager.php b/typo3/sysext/extbase/Classes/Object/ObjectManager.php
new file mode 100644 (file)
index 0000000..b4f875c
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+*  All rights reserved
+*
+*  This class is a backport of the corresponding class of FLOW3.
+*  All credits go to the v5 team.
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Implementation of the default Extbase Object Manager
+ *
+ * @package Extbase
+ * @subpackage Object
+ */
+class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManagerInterface {
+
+       /**
+        * @var Tx_Container_Container
+        */
+       protected $objectContainer;
+
+       /**
+        * Constructs a new Object Manager
+        */
+       public function __construct() {
+               $this->objectContainer = Tx_Container_Container::getContainer();
+       }
+
+       /**
+     * Returns a fresh or existing instance of the object specified by $objectName.
+     *
+     * Important:
+     *
+     * If possible, instances of Prototype objects should always be created with the
+     * Object Manager's create() method and Singleton objects should rather be
+     * injected by some type of Dependency Injection.
+     *
+     * @param string $objectName The name of the object to return an instance of
+     * @return object The object instance
+     * @api
+     */
+       public function get($objectName) {
+               return call_user_func_array(array($this->objectContainer, 'getInstance'), func_get_args());
+       }
+
+       /**
+        * Creates a fresh instance of the object specified by $objectName.
+        *
+        * This factory method can only create objects of the scope prototype.
+        * Singleton objects must be either injected by some type of Dependency Injection or
+        * if that is not possible, be retrieved by the get() method of the
+        * Object Manager
+        *
+        * @param string $objectName The name of the object to create
+        * @return object The new object instance
+        * @throws Tx_Extbase_Object_Exception_WrongScropeException if the created object is not of scope prototype
+        * @api
+        */
+       public function create($objectName) {
+               $instance = call_user_func_array(array($this->objectContainer, 'getInstance'), func_get_args());
+
+               if ($instance instanceof t3lib_Singleton) {
+                       throw new Tx_Extbase_Object_Exception_WrongScope('Object "' . $objectName . '" is of not of scope prototype, but only prototype is supported by create()', 1265203124);
+               }
+
+               return $instance;
+       }
+
+       /**
+        * Registers a classname that should be used to resolve a given interface.
+        *
+        * Per default the interface's name stripped of "Interface" will be used.
+        * @param string $className
+        * @param string $alternativeClassName
+        */
+       static public function registerImplementation($className, $alternativeClassName) {
+               return Tx_Container_Container::getContainer()->registerImplementation($className, $alternativeClassName);
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/ObjectManagerInterface.php b/typo3/sysext/extbase/Classes/Object/ObjectManagerInterface.php
new file mode 100644 (file)
index 0000000..c408b0c
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+*  All rights reserved
+*
+*  This class is a backport of the corresponding class of FLOW3. 
+*  All credits go to the v5 team.
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Interface for the TYPO3 Object Manager
+ *
+ * @package Extbase
+ * @subpackage Object
+ */
+interface Tx_Extbase_Object_ObjectManagerInterface extends t3lib_Singleton {
+    /**
+     * Returns a fresh or existing instance of the object specified by $objectName.
+     *
+     * Important:
+     *
+     * If possible, instances of Prototype objects should always be created with the
+     * Object Manager's create() method and Singleton objects should rather be
+     * injected by some type of Dependency Injection.
+     *
+     * @param string $objectName The name of the object to return an instance of
+     * @return object The object instance
+     * @api
+     */
+    public function get($objectName);
+
+       /**
+        * Creates a fresh instance of the object specified by $objectName.
+        *
+        * This factory method can only create objects of the scope prototype.
+        * Singleton objects must be either injected by some type of Dependency Injection or
+        * if that is not possible, be retrieved by the get() method of the
+        * Object Manager
+        *
+        * @param string $objectName The name of the object to create
+        * @return object The new object instance
+        * @throws Tx_Extbase_Object_Exception_WrongScropeException if the created object is not of scope prototype
+        * @api
+        */
+       public function create($objectName);
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/RegistryInterface.php b/typo3/sysext/extbase/Classes/Object/RegistryInterface.php
deleted file mode 100644 (file)
index 1c99c9f..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Object Object Cache Interface
- *
- * @package Extbase
- * @subpackage Object
- * @version $Id$
- */
-interface Tx_Extbase_Object_RegistryInterface {
-
-       /**
-        * Returns an object from the registry. If an instance of the required
-        * object does not exist yet, an exception is thrown.
-        *
-        * @param string $objectName Name of the object to return an object of
-        * @return object The object
-        */
-       public function getObject($objectName);
-
-       /**
-        * Put an object into the registry.
-        *
-        * @param string $objectName Name of the object the object is made for
-        * @param object $object The object to store in the registry
-        * @return void
-        */
-       public function putObject($objectName, $object);
-
-       /**
-        * Remove an object from the registry.
-        *
-        * @param string $objectName Name of the object to remove the object for
-        * @return void
-        */
-       public function removeObject($objectName);
-
-       /**
-        * Checks if an object of the given object already exists in the object registry.
-        *
-        * @param string $objectName Name of the object to check for an object
-        * @return boolean TRUE if an object exists, otherwise FALSE
-        */
-       public function objectExists($objectName);
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/TransientRegistry.php b/typo3/sysext/extbase/Classes/Object/TransientRegistry.php
deleted file mode 100644 (file)
index f450ab0..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * A transient Object Object Cache which provides a transient memory-based
- * registry of objects.
- *
- * @package Extbase
- * @subpackage Object
- * @version $Id$
- */
-class Tx_Extbase_Object_TransientRegistry implements Tx_Extbase_Object_RegistryInterface {
-
-       /**
-        * @var array Location where objects are stored
-        */
-       protected $objects = array();
-
-       /**
-        * Returns an object from the registry. If an instance of the required
-        * object does not exist yet, an exception is thrown.
-        *
-        * @param string $objectName Name of the object to return an object of
-        * @return object The object
-        */
-       public function getObject($objectName) {
-               if (!$this->objectExists($objectName)) throw new RuntimeException('Object "' . $objectName . '" does not exist in the object registry.', 1167917198);
-               return $this->objects[$objectName];
-       }
-
-       /**
-        * Put an object into the registry.
-        *
-        * @param string $objectName Name of the object the object is made for
-        * @param object $object The object to store in the registry
-        * @return void
-        */
-       public function putObject($objectName, $object) {
-               if (!is_string($objectName) || strlen($objectName) === 0) throw new RuntimeException('No valid object name specified.', 1167919564);
-               if (!is_object($object)) throw new RuntimeException('$object must be of type Object', 1167917199);
-               $this->objects[$objectName] = $object;
-       }
-
-       /**
-        * Remove an object from the registry.
-        *
-        * @param string objectName Name of the object to remove the object for
-        * @return void
-        */
-       public function removeObject($objectName) {
-               if (!$this->objectExists($objectName)) throw new RuntimeException('Object "' . $objectName . '" does not exist in the object registry.', 1167917200);
-               unset ($this->objects[$objectName]);
-       }
-
-       /**
-        * Checks if an object of the given object already exists in the object registry.
-        *
-        * @param string $objectName Name of the object to check for an object
-        * @return boolean TRUE if an object exists, otherwise FALSE
-        */
-       public function objectExists($objectName) {
-               return isset($this->objects[$objectName]);
-       }
-
-}
-
-?>
\ No newline at end of file
index 84e821c..7b36d48 100644 (file)
@@ -66,7 +66,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
        protected $queryFactory;
 
        /**
-        * @var Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface
+        * @var Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
         */
        protected $qomFactory;
 
@@ -163,10 +163,10 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
        /**
         * Injects the QueryObjectModelFactory
         *
-        * @param Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface $qomFactory
+        * @param Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory
         * @return void
         */
-       public function injectQomFactory(Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface $qomFactory) {
+       public function injectQomFactory(Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory) {
                $this->qomFactory = $qomFactory;
        }
 
@@ -191,7 +191,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
        /**
         * Returns the current QOM factory
         *
-        * @return Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface
+        * @return Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
         */
        public function getQomFactory() {
                return $this->qomFactory;
index 0e4e85f..6dcba6e 100644 (file)
@@ -32,7 +32,7 @@
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @see \F3\TYPO3CR\FLOW3\Persistence\DataMapper, \F3\TYPO3CR\FLOW3\Persistence\Backend
  */
-class Tx_Extbase_Persistence_IdentityMap {
+class Tx_Extbase_Persistence_IdentityMap implements t3lib_Singleton {
 
        /**
         * @var Tx_Extbase_Persistence_ObjectStorage
index a10eecf..f81ca64 100644 (file)
 class Tx_Extbase_Persistence_LazyLoadingProxy implements Iterator, Tx_Extbase_Persistence_LoadingStrategyInterface {
 
        /**
+        * @var Tx_Extbase_Persistence_DataMapper
+        */
+       protected $dataMapper;
+
+       /**
         * The object this property is contained in.
         *
         * @var object
@@ -70,6 +75,16 @@ class Tx_Extbase_Persistence_LazyLoadingProxy implements Iterator, Tx_Extbase_Pe
        }
 
        /**
+        * Injects the DataMapper to map nodes to objects
+        *
+        * @param Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper
+        * @return void
+        */
+       public function injectDataMapper(Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper) {
+               $this->dataMapper = $dataMapper;
+       }
+
+       /**
         * Populate this proxy by asking the $population closure.
         *
         * @return object The instance (hopefully) returned
@@ -79,9 +94,9 @@ class Tx_Extbase_Persistence_LazyLoadingProxy implements Iterator, Tx_Extbase_Pe
                // usually that does not happen, but if the proxy is held from outside
                // it's parent... the result would be weird.
                if ($this->parentObject->_getProperty($this->propertyName) instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
-                       $dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
-                       $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE, FALSE);
-                       $propertyValue = $dataMapper->mapResultToPropertyValue($this->parentObject, $this->propertyName, $objects);
+                       
+                       $objects = $this->dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE, FALSE);
+                       $propertyValue = $this->dataMapper->mapResultToPropertyValue($this->parentObject, $this->propertyName, $objects);
                        $this->parentObject->_setProperty($this->propertyName, $propertyValue);
                        $this->parentObject->_memorizeCleanState($this->propertyName);
                        return $propertyValue;
index ea11a60..65e5cba 100644 (file)
 class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_ObjectStorage implements Tx_Extbase_Persistence_LoadingStrategyInterface {
 
        /**
+        * @var Tx_Extbase_Persistence_DataMapper
+        */
+       protected $dataMapper;
+
+       /**
         * The object this property is contained in.
         *
         * @var object
@@ -83,7 +88,17 @@ class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_Ob
                $this->propertyName = $propertyName;
                $this->fieldValue = $fieldValue;
        }
-       
+
+       /**
+        * Injects the DataMapper to map nodes to objects
+        *
+        * @param Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper
+        * @return void
+        */
+       public function injectDataMapper(Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper) {
+               $this->dataMapper = $dataMapper;
+       }
+
        /**
         * This is a function lazy load implementation. 
         *
@@ -92,8 +107,8 @@ class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_Ob
        protected function initialize() {
                if (!$this->isInitialized) {
                        $this->isInitialized = TRUE;
-                       $dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
-                       $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE);
+
+                       $objects = $this->dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE);
                        foreach ($objects as $object) {
                                parent::attach($object);
                        }
@@ -134,11 +149,10 @@ class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_Ob
         * @return int The number of elements in the ObjectStorage
         */
        public function count() {
-               $dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
-               $columnMap = $dataMapper->getDataMap(get_class($this->parentObject))->getColumnMap($this->propertyName);
+               $columnMap = $this->dataMapper->getDataMap(get_class($this->parentObject))->getColumnMap($this->propertyName);
                $numberOfElements = NULL;
                if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
-                       $numberOfElements = $dataMapper->countRelated($this->parentObject, $this->propertyName, $this->fieldValue);
+                       $numberOfElements = $this->dataMapper->countRelated($this->parentObject, $this->propertyName, $this->fieldValue);
                } else {
                        $this->initialize();
                        $numberOfElements = count($this->storage);                      
index b3d0067..1ee7faf 100644 (file)
@@ -46,7 +46,7 @@ class Tx_Extbase_Persistence_Manager implements Tx_Extbase_Persistence_ManagerIn
        protected $session;
 
        /**
-        * @var Tx_Extbase_Object_ManagerInterface
+        * @var Tx_Extbase_Object_ObjectManagerInterface
         */
        protected $objectManager;
 
@@ -81,10 +81,10 @@ class Tx_Extbase_Persistence_Manager implements Tx_Extbase_Persistence_ManagerIn
        /**
         * Injects the object manager
         *
-        * @param Tx_Extbase_Object_ManagerInterface $objectManager
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
         * @return void
         */
-       public function injectObjectManager(Tx_Extbase_Object_ManagerInterface $objectManager) {
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
        }
 
@@ -115,15 +115,6 @@ class Tx_Extbase_Persistence_Manager implements Tx_Extbase_Persistence_ManagerIn
        public function registerRepositoryClassName($className) {
                $this->repositoryClassNames[] = $className;
        }
-
-       /**
-        * Returns all repository class names
-        *
-        * @return array An array holding the registered repository class names
-        */
-       public function getRepositoryClassNames() {
-               return $this->repositoryClassNames;
-       }
        
        /**
         * Returns the number of records matching the query.
@@ -159,9 +150,8 @@ class Tx_Extbase_Persistence_Manager implements Tx_Extbase_Persistence_ManagerIn
                $removedObjects = new Tx_Extbase_Persistence_ObjectStorage();
 
                        // fetch and inspect objects from all known repositories
-               $repositoryClassNames = $this->getRepositoryClassNames();
-               foreach ($repositoryClassNames as $repositoryClassName) {
-                       $repository = $this->objectManager->getObject($repositoryClassName);
+               foreach ($this->repositoryClassNames as $repositoryClassName) {
+                       $repository = $this->objectManager->get($repositoryClassName);
                        $aggregateRootObjects->addAll($repository->getAddedObjects());
                        $removedObjects->addAll($repository->getRemovedObjects());
                }
index 48c9164..9736849 100644 (file)
@@ -29,7 +29,7 @@
  * @subpackage Persistence\Mapper
  * @version $ID:$
  */
-class Tx_Extbase_Persistence_Mapper_DataMapFactory {
+class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
        
        /**
         * @var Tx_Extbase_Reflection_Service
@@ -91,7 +91,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory {
                        }
                }
 
-               $dataMap = t3lib_div::makeInstance('Tx_Extbase_Persistence_Mapper_DataMap', $className, $tableName, $recordType, $subclasses);
+               $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap($className, $tableName, $recordType, $subclasses);
                $dataMap = $this->addMetaDataColumnNames($dataMap, $tableName);
 
                // $classPropertyNames = $this->reflectionService->getClassPropertyNames($className);
index 80547f6..4f88f96 100644 (file)
@@ -83,12 +83,9 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
        protected $referenceIndex;
 
        /**
-        * Constructs a new mapper
-        *
+        * @var Tx_Extbase_Object_ObjectManagerInterface
         */
-       public function __construct() {
-               $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
-       }
+       protected $objectManager;
 
        /**
         * Injects the identity map
@@ -129,6 +126,15 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
        public function injectDataMapFactory(Tx_Extbase_Persistence_Mapper_DataMapFactory $dataMapFactory) {
                $this->dataMapFactory = $dataMapFactory;
        }
+
+       /**
+        * Injects the Query Factory
+        *
+        * @param Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory
+        */
+       public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory) {
+               $this->queryFactory = $queryFactory;
+       }
        
        /**
         * Sets the query object model factory
@@ -141,6 +147,14 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
        }
 
        /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
         * Maps the given rows on objects
         *
         * @param string $className The name of the class
@@ -304,12 +318,12 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                $propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
                if ($enableLazyLoading === TRUE && $propertyMetaData['lazy']) {
                        if ($propertyMetaData['type'] === 'Tx_Extbase_Persistence_ObjectStorage') {
-                               $result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyObjectStorage', $parentObject, $propertyName, $fieldValue);                               
+                               $result = $this->objectManager->create('Tx_Extbase_Persistence_LazyObjectStorage', $parentObject, $propertyName, $fieldValue);
                        } else {
                                if (empty($fieldValue)) {
                                        $result = NULL;
                                } else {
-                                       $result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue);
+                                       $result = $this->objectManager->create('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue);
                                }
                        }
                } else {
@@ -344,8 +358,8 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
        protected function getPreparedQuery(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '') {
                $columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
                $type = $this->getType(get_class($parentObject), $propertyName);
-               $queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
-               $query = $queryFactory->create($type);
+
+               $query = $this->queryFactory->create($type);
                $query->getQuerySettings()->setRespectStoragePage(FALSE);
                if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
                        if ($columnMap->getChildSortByFieldName() !== NULL) {
index 5c82294..591cb02 100644 (file)
  * @version $Id$
  * @scope prototype
  */
-class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface, t3lib_Singleton {
-// SK: Needs to be cleaned up (methods might need to be removed, and comments fixed)
+class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements t3lib_Singleton {
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+       
+       /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
        /**
         * Selects a subset of the nodes in the repository based on node type.
         *
@@ -47,7 +60,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
                if ($selectorName === '') {
                        $selectorName = $nodeTypeName;
                }
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_Selector', $selectorName, $nodeTypeName);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_Selector', $selectorName, $nodeTypeName);
        }
        
        /**
@@ -59,7 +72,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @return Tx_Extbase_Persistence_QOM_StatementInterface
         */
        public function statement($statement, array $boundVariables = array(), $language = Tx_Extbase_Persistence_QOM_Statement::TYPO3_SQL_MYSQL) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_Statement', $statement, $boundVariables, $language);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_Statement', $statement, $boundVariables, $language);
        }
 
        /**
@@ -73,7 +86,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function join(Tx_Extbase_Persistence_QOM_SourceInterface $left, Tx_Extbase_Persistence_QOM_SourceInterface $right, $joinType, Tx_Extbase_Persistence_QOM_JoinConditionInterface $joinCondition) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_Join', $left, $right, $joinType, $joinCondition);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_Join', $left, $right, $joinType, $joinCondition);
        }
 
        /**
@@ -87,7 +100,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function equiJoinCondition($selector1Name, $property1Name, $selector2Name, $property2Name) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_EquiJoinCondition', $selector1Name, $property1Name, $selector2Name, $property2Name);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_EquiJoinCondition', $selector1Name, $property1Name, $selector2Name, $property2Name);
        }
 
        /**
@@ -99,7 +112,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function _and(Tx_Extbase_Persistence_QOM_ConstraintInterface $constraint1, Tx_Extbase_Persistence_QOM_ConstraintInterface $constraint2) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_LogicalAnd', $constraint1, $constraint2);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_LogicalAnd', $constraint1, $constraint2);
        }
 
        /**
@@ -111,7 +124,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function _or(Tx_Extbase_Persistence_QOM_ConstraintInterface $constraint1, Tx_Extbase_Persistence_QOM_ConstraintInterface $constraint2) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_LogicalOr', $constraint1, $constraint2);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_LogicalOr', $constraint1, $constraint2);
        }
 
        /**
@@ -122,7 +135,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function not(Tx_Extbase_Persistence_QOM_ConstraintInterface $constraint) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_LogicalNot', $constraint);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_LogicalNot', $constraint);
        }
        
        /**
@@ -135,7 +148,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function comparison(Tx_Extbase_Persistence_QOM_DynamicOperandInterface $operand1, $operator, $operand2) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_Comparison', $operand1, $operator, $operand2);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_Comparison', $operand1, $operator, $operand2);
        }
        
        /**
@@ -147,7 +160,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function propertyValue($propertyName, $selectorName = '') {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_PropertyValue', $propertyName, $selectorName);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_PropertyValue', $propertyName, $selectorName);
        }
        
        /**
@@ -158,7 +171,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function lowerCase(Tx_Extbase_Persistence_QOM_DynamicOperandInterface $operand) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_LowerCase', $operand);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_LowerCase', $operand);
        }
 
        /**
@@ -169,7 +182,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function upperCase(Tx_Extbase_Persistence_QOM_DynamicOperandInterface $operand) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_UpperCase', $operand);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_UpperCase', $operand);
        }
        
        /**
@@ -182,7 +195,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function ascending(Tx_Extbase_Persistence_QOM_DynamicOperandInterface $operand) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_Ordering', $operand, Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_Ordering', $operand, Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING);
        }
 
        /**
@@ -195,7 +208,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function descending(Tx_Extbase_Persistence_QOM_DynamicOperandInterface $operand) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_Ordering', $operand, Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_Ordering', $operand, Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING);
        }
        
        /**
@@ -206,7 +219,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModelFactory implements Tx_Extbase_P
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if the operation otherwise fails
         */
        public function bindVariable($bindVariableName) {
-               return t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_BindVariableValue', $bindVariableName);
+               return $this->objectManager->create('Tx_Extbase_Persistence_QOM_BindVariableValue', $bindVariableName);
        }
        
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactoryInterface.php b/typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactoryInterface.php
deleted file mode 100644 (file)
index af18fa1..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * A QueryObjectModelFactory creates instances of the JCR query object model.
- *
- * Refer to QueryObjectModelInterface for a description of the query object model.
- *
- * @package Extbase
- * @subpackage Persistence\QOM
- * @version $Id$
- */
-interface Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface extends Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface {
-
-
-}
-
-?>
\ No newline at end of file
index 45405cd..6d6747e 100644 (file)
@@ -52,7 +52,7 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
        protected $persistenceManager;
 
        /**
-        * @var Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface
+        * @var Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
         */
        protected $qomFactory;
 
@@ -110,7 +110,6 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         */
        public function injectPersistenceManager(Tx_Extbase_Persistence_ManagerInterface $persistenceManager) {
                $this->persistenceManager = $persistenceManager;
-               $this->qomFactory = $this->persistenceManager->getBackend()->getQomFactory();
        }
 
        /**
@@ -124,6 +123,16 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
        }
 
        /**
+        * Injects the Query Object Model Factory
+        *
+        * @param Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory
+        * @return void
+        */
+       public function injectQomFactory(Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory) {
+               $this->qomFactory = $qomFactory;
+       }
+
+       /**
         * Sets the Query Settings. These Query settings must match the settings expected by
         * the specific Storage Backend.
         *
index 28d72f0..4ad9167 100644 (file)
 class Tx_Extbase_Persistence_QueryFactory implements Tx_Extbase_Persistence_QueryFactoryInterface, t3lib_Singleton {
 
        /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        * @author Sebastian Kurfürst <sebastian@typo3.org>
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
         * Creates a query object working on the given class name
         *
         * @param string $className The class name
         * @return Tx_Extbase_Persistence_QueryInterface
         */
        public function create($className) {
-               $persistenceManager = Tx_Extbase_Dispatcher::getPersistenceManager();
-
-               $reflectionService = $persistenceManager->getBackend()->getReflectionService();
-               
-               $dataMapFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_Mapper_DataMapFactory');
-               $dataMapFactory->injectReflectionService($reflectionService);
-
-               $dataMapper = t3lib_div::makeInstance('Tx_Extbase_Persistence_Mapper_DataMapper');
-               $dataMapper->injectIdentityMap($persistenceManager->getBackend()->getIdentityMap());
-               $dataMapper->injectSession($persistenceManager->getSession());
-               $dataMapper->injectReflectionService($reflectionService);
-               $dataMapper->injectDataMapFactory($dataMapFactory);
-               
-               $querySettings = t3lib_div::makeInstance('Tx_Extbase_Persistence_Typo3QuerySettings');
-
-               $query = t3lib_div::makeInstance('Tx_Extbase_Persistence_Query', $className);
-               $query->injectPersistenceManager($persistenceManager);
-               $query->injectDataMapper($dataMapper);
+               $query = $this->objectManager->create('Tx_Extbase_Persistence_QueryInterface', $className);
+               $querySettings = $this->objectManager->create('Tx_Extbase_Persistence_Typo3QuerySettings');
                $query->setQuerySettings($querySettings);
 
                return $query;
index 54dda45..fddab2c 100644 (file)
@@ -72,15 +72,46 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
        /**
         * Constructs a new Repository
         *
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
         */
-       public function __construct() {
-               $this->identityMap = t3lib_div::makeInstance('Tx_Extbase_Persistence_IdentityMap');
+       public function __construct(Tx_Extbase_Object_ObjectManagerInterface $objectManager = NULL) {
                $this->addedObjects = new Tx_Extbase_Persistence_ObjectStorage();
                $this->removedObjects = new Tx_Extbase_Persistence_ObjectStorage();
-               $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory'); // singleton
-               $this->persistenceManager = Tx_Extbase_Dispatcher::getPersistenceManager();
-               $this->persistenceManager->registerRepositoryClassName($this->getRepositoryClassName());
                $this->objectType = str_replace(array('_Repository_', 'Repository'), array('_Model_', ''), $this->getRepositoryClassName());
+
+               if ($objectManager === NULL) {
+                       // Legacy creation, in case the object manager is NOT injected
+                       // If ObjectManager IS there, then all properties are automatically injected
+                       $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
+                       $this->injectIdentityMap($objectManager->get('Tx_Extbase_Persistence_IdentityMap'));
+                       $this->injectQueryFactory($objectManager->get('Tx_Extbase_Persistence_QueryFactory'));
+                       $this->injectPersistenceManager($objectManager->get('Tx_Extbase_Persistence_Manager'));
+               }
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_IdentityMap $identityMap
+        * @return void
+        */
+       public function injectIdentityMap(Tx_Extbase_Persistence_IdentityMap $identityMap) {
+               $this->identityMap = $identityMap;
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_QueryFactory $queryFactory
+        * @return void
+        */
+       public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactory $queryFactory) {
+               $this->queryFactory = $queryFactory;
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_Manager $persistenceManager
+        * @return void
+        */
+       public function injectPersistenceManager(Tx_Extbase_Persistence_Manager $persistenceManager) {
+               $this->persistenceManager = $persistenceManager;
+               $this->persistenceManager->registerRepositoryClassName($this->getRepositoryClassName());
        }
 
        /**
index 4f88a17..3ea0672 100644 (file)
@@ -50,7 +50,7 @@
  * @version $Id$
  * @api
  */
-class Tx_Extbase_Property_Mapper {
+class Tx_Extbase_Property_Mapper implements t3lib_Singleton {
 
        /**
         * Results of the last mapping operation
@@ -79,15 +79,28 @@ class Tx_Extbase_Property_Mapper {
        protected $queryFactory;
 
        /**
-        * Constructs the Property Mapper.
+        * @param Tx_Extbase_Validation_ValidatorResolver $validatorResolver 
+        * @return void
+        */
+       public function injectValidatorResolver(Tx_Extbase_Validation_ValidatorResolver $validatorResolver) {
+               $this->validatorResolver = $validatorResolver;
+       }
+
+       /**
+        *
+        * @param Tx_Extbase_Persistence_QueryFactory $queryFactory
+        * @return void
+        */
+       public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactory $queryFactory) {
+               $this->queryFactory = $queryFactory;
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_Manager $persistenceManager
+        * @return void
         */
-       public function __construct() {
-               // TODO Clean up this dependencies; inject the instance
-               $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_Manager');
-               $this->validatorResolver = t3lib_div::makeInstance('Tx_Extbase_Validation_ValidatorResolver');
-               $this->validatorResolver->injectObjectManager($objectManager);
-               $this->persistenceManager = Tx_Extbase_Dispatcher::getPersistenceManager();
-               $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
+       public function injectPersistenceManager(Tx_Extbase_Persistence_Manager $persistenceManager) {
+               $this->persistenceManager = $persistenceManager;
        }
 
        /**
index 41cf137..04a2772 100644 (file)
@@ -52,10 +52,11 @@ class Tx_Extbase_Security_Channel_RequestHashService implements t3lib_singleton
        protected $hashService;
 
        /**
-        * Constructor
+        * @param Tx_Extbase_Security_Cryptography_HashService $hashService 
+        * @return void
         */
-       public function __construct() {
-               $this->hashService = t3lib_div::makeInstance('Tx_Extbase_Security_Cryptography_HashService'); // Singleton
+       public function injectHashService(Tx_Extbase_Security_Cryptography_HashService $hashService) {
+               $this->hashService = $hashService;
        }
 
        /**
index f080459..275b76e 100644 (file)
@@ -70,7 +70,7 @@ abstract class Tx_Extbase_Validation_Validator_AbstractValidator implements Tx_E
         * @return void
         */
        protected function addError($message, $code) {
-               $this->errors[] = t3lib_div::makeInstance('Tx_Extbase_Validation_Error', $message, $code);
+               $this->errors[] = new Tx_Extbase_Validation_Error($message, $code);
        }
 }
 
index 735005a..94d8bc0 100644 (file)
@@ -106,7 +106,7 @@ class Tx_Extbase_Validation_Validator_GenericObjectValidator extends Tx_Extbase_
         */
        protected function addErrorsForProperty($errors, $propertyName) {
                if (!isset($this->errors[$propertyName])) {
-                       $this->errors[$propertyName] = t3lib_div::makeInstance('Tx_Extbase_Validation_PropertyError', $propertyName);
+                       $this->errors[$propertyName] = new Tx_Extbase_Validation_PropertyError($propertyName);
                }
                $this->errors[$propertyName]->addErrors($errors);
        }
index 74d7eb2..c0b475e 100644 (file)
@@ -32,7 +32,7 @@
  * @subpackage Validation
  * @version $Id$
  */
-class Tx_Extbase_Validation_ValidatorResolver {
+class Tx_Extbase_Validation_ValidatorResolver implements t3lib_Singleton {
 
        /**
         * Match validator names and options
@@ -67,7 +67,7 @@ class Tx_Extbase_Validation_ValidatorResolver {
                /ixS';
 
        /**
-        * @var Tx_Extbase_Object_ManagerInterface
+        * @var Tx_Extbase_Object_ObjectManagerInterface
         */
        protected $objectManager;
 
@@ -84,10 +84,10 @@ class Tx_Extbase_Validation_ValidatorResolver {
        /**
         * Injects the object manager
         *
-        * @param Tx_Extbase_Object_ManagerInterface $objectManager A reference to the object manager
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager A reference to the object manager
         * @return void
         */
-       public function injectObjectManager(Tx_Extbase_Object_ManagerInterface $objectManager) {
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
        }
 
@@ -113,7 +113,7 @@ class Tx_Extbase_Validation_ValidatorResolver {
        public function createValidator($validatorName, array $validatorOptions = array()) {
                $validatorClassName = $this->resolveValidatorObjectName($validatorName);
                if ($validatorClassName === FALSE) return NULL;
-               $validator = $this->objectManager->getObject($validatorClassName);
+               $validator = $this->objectManager->get($validatorClassName);
                if (!($validator instanceof Tx_Extbase_Validation_Validator_ValidatorInterface)) {
                        return NULL;
                }
@@ -196,7 +196,7 @@ class Tx_Extbase_Validation_ValidatorResolver {
         * @return Tx_Extbase_Validation_Validator_ConjunctionValidator The validator conjunction or NULL
         */
        protected function buildBaseValidatorConjunction($dataType) {
-               $validatorConjunction = $this->objectManager->getObject('Tx_Extbase_Validation_Validator_ConjunctionValidator');
+               $validatorConjunction = $this->objectManager->get('Tx_Extbase_Validation_Validator_ConjunctionValidator');
 
                // Model based validator
                if (strstr($dataType, '_') !== FALSE && class_exists($dataType)) {
index e24d0ae..3749deb 100644 (file)
@@ -33,7 +33,7 @@ require_once(t3lib_extMgm::extPath('phpunit') . 'class.tx_phpunit_testcase.php')
 abstract class Tx_Extbase_BaseTestCase extends tx_phpunit_testcase {
 
        /**
-        * @var Tx_Extbase_Object_ManagerInterface The object manager
+        * @var Tx_Extbase_Object_ObjectManagerInterface The object manager
         */
        protected $objectManager;
 
@@ -59,7 +59,7 @@ abstract class Tx_Extbase_BaseTestCase extends tx_phpunit_testcase {
         * @return void
         */
        public function runBare() {
-               $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_Manager');
+               $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
                $this->objectManager =  clone $objectManager;
                parent::runBare();
        }
index 674d0da..876b9ac 100644 (file)
@@ -178,7 +178,7 @@ class Tx_Extbase_MVC_Controller_ActionController_testcase extends Tx_Extbase_Bas
                $mockFluidTemplateView->expects($this->once())->method('setControllerContext')->with($mockControllerContext);
                $mockFluidTemplateView->expects($this->once())->method('hasTemplate')->will($this->returnValue(TRUE));
 
-               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ManagerInterface', array(), array(), '', FALSE);
+               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface', array(), array(), '', FALSE);
                $mockObjectManager->expects($this->at(0))->method('getObject')->with('Tx_Fluid_View_TemplateView')->will($this->returnValue($mockFluidTemplateView));
 
                $mockController = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_MVC_Controller_ActionController'), array('buildControllerContext'), array(), '', FALSE);
@@ -200,7 +200,7 @@ class Tx_Extbase_MVC_Controller_ActionController_testcase extends Tx_Extbase_Bas
                $mockRequest->expects($this->once())->method('getControllerActionName')->will($this->returnValue('MyAction'));
                $mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('MyFormat'));
 
-               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ManagerInterface', array(), array(), '', FALSE);
+               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface', array(), array(), '', FALSE);
                
                $mockController = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_MVC_Controller_ActionController'), array('dummy'), array(), '', FALSE);
                $mockController->_set('request', $mockRequest);
index 19a15b8..4f5d03c 100644 (file)
@@ -38,7 +38,7 @@ class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_BaseTe
         * @test
         */
        public function resolveValidatorObjectNameReturnsFalseIfValidatorCantBeResolved() {
-               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ManagerInterface');
+               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
                $validatorResolver = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Validation_ValidatorResolver'), array('dummy'));
                $validatorResolver->_set('objectManager', $objectManager);
                $this->assertSame(FALSE, $validatorResolver->_call('resolveValidatorObjectName', 'Foo'));
@@ -58,7 +58,7 @@ class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_BaseTe
         * @test
         */
        public function resolveValidatorObjectNameCanResolveShortNamesOfBuiltInValidators() {
-               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ManagerInterface');
+               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
                eval('class Tx_Extbase_Validation_Validator_FooValidator {}');
                $validatorResolver = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Validation_ValidatorResolver'), array('dummy'));
                $validatorResolver->_set('objectManager', $mockObjectManager);
@@ -73,7 +73,7 @@ class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_BaseTe
                $mockValidator = $this->getMock('Tx_Extbase_Validation_Validator_ObjectValidatorInterface', array(), array(), $className);
                $mockValidator->expects($this->once())->method('setOptions')->with(array('foo' => 'bar'));
 
-               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ManagerInterface');
+               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
                $mockObjectManager->expects($this->any())->method('getObject')->with($className)->will($this->returnValue($mockValidator));
 
                $validatorResolver = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Validation_ValidatorResolver'),array('resolveValidatorObjectName'));
@@ -274,7 +274,7 @@ class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_BaseTe
                $mockConjunctionValidator = $this->getMock('Tx_Extbase_Validation_Validator_ConjunctionValidator', array(), array(), '', FALSE);
                $mockConjunctionValidator->expects($this->once())->method('addValidator')->with($mockObjectValidator);
 
-               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ManagerInterface', array(), array(), '', FALSE);
+               $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface', array(), array(), '', FALSE);
                $mockObjectManager->expects($this->at(0))->method('getObject')->with('Tx_Extbase_Validation_Validator_ConjunctionValidator')->will($this->returnValue($mockConjunctionValidator));
 
                $validatorResolver = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Validation_ValidatorResolver'), array('resolveValidatorObjectName', 'createValidator'));
index e94f86c..3c0f0bc 100644 (file)
@@ -69,12 +69,11 @@ return array(
        'tx_extbase_mvc_web_response' => $extensionClassesPath . 'MVC/Web/Response.php',
        'tx_extbase_mvc_web_routing_uribuilder' => $extensionClassesPath . 'MVC/Web/Routing/UriBuilder.php',
        'tx_extbase_object_exception' => $extensionClassesPath . 'Object/Exception.php',
-       'tx_extbase_object_manager' => $extensionClassesPath . 'Object/Manager.php',
-       'tx_extbase_object_managerinterface' => $extensionClassesPath . 'Object/ManagerInterface.php',
-       'tx_extbase_object_registryinterface' => $extensionClassesPath . 'Object/RegistryInterface.php',
-       'tx_extbase_object_transientregistry' => $extensionClassesPath . 'Object/TransientRegistry.php',
+       'tx_extbase_object_objectmanager' => $extensionClassesPath . 'Object/ObjectManager.php',
+       'tx_extbase_object_objectmanagerinterface' => $extensionClassesPath . 'Object/ObjectManagerInterface.php',
        'tx_extbase_object_cannotbuildobject' => $extensionClassesPath . 'Object/Exception/CannotBuildObject.php',
        'tx_extbase_object_exception_cannotreconstituteobject' => $extensionClassesPath . 'Object/Exception/CannotReconstituteObject.php',
+       'tx_extbase_object_exception_wrongscope' => $extensionClassesPath . 'Object/Exception/WrongScope.php',
        'tx_extbase_object_invalidclass' => $extensionClassesPath . 'Object/Exception/InvalidClass.php',
        'tx_extbase_object_invalidobject' => $extensionClassesPath . 'Object/Exception/InvalidObject.php',
        'tx_extbase_object_invalidobjectconfiguration' => $extensionClassesPath . 'Object/Exception/InvalidObjectConfiguration.php',
index 356de2a..5133e59 100644 (file)
@@ -15,5 +15,5 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extb
 );
 
 # $GLOBALS ['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:extbase/Classes/Persistence/Hook/TCEMainValueObjectUpdater.php:tx_Extbase_Persistence_Hook_TCEMainValueObjectUpdater';
-Tx_Extbase_Object_Manager::registerImplementation('Tx_Extbase_Persistence_Storage_BackendInterface', 'Tx_Extbase_Persistence_Storage_Typo3DbBackend');
+Tx_Extbase_Object_ObjectManager::registerImplementation('Tx_Extbase_Persistence_Storage_BackendInterface', 'Tx_Extbase_Persistence_Storage_Typo3DbBackend');
 ?>
\ No newline at end of file