[!!!] Extbase: Reintegrating branch "dispatcher" to trunk. Resolves: #10605
authorBastian Waidelich <bastian@typo3.org>
Wed, 10 Nov 2010 18:56:01 +0000 (18:56 +0000)
committerBastian Waidelich <bastian@typo3.org>
Wed, 10 Nov 2010 18:56:01 +0000 (18:56 +0000)
Branch history:
[+FEATURE] Extbase (Configuration): Extend ConfigurationManager so that it can load configuration of different plugins
[+FEATURE] Extbase (Configuration): 1st level cache for ConfigurationManager. Resolves: #10717. Resolves: #10716
[+TASK] Extbase: cleaned up Configuration* implementation, replaced t3lib_div::makeInstance() calls
Streamlined ConfigurationManager API and enforced its usage throughout the Extbase classes.
Replaced all t3lib_div::makeInstance() calls by $objectManager->create()/$objectManager->get() throughout the Extbase classes.
Some smaller tweaks and fixes. Resolves: #10655. Resolves: #10712
[TASK] Extbase (Object): Make tests work again. Resolves: #10709
[TASK] Extbase (Object): Updated autoload.php and emconf. Relates to: #10561
[TASK] Extbase (Object): Use typed exceptions. Relates to: #10561
[TASK] Extbase (Object): CGL cleanup
Additionally, removed support for @inject annotations at methods. Relates to: #10561
[TASK] Extbase (Object): Remove getParents. Relates to: #10561
[TASK] Extbase (Object): Remove isSingleton. Relates to: #10561
[TASK] Extbase (Object): Remove injectExtensionSettings feature. Relates to: #10561
[TASK] Extbase (Object): Change namespaces to Tx_Extbase_Object_Container. Relates to: #10561
[TASK] Extbase (Object): Add Container to Extbase. Relates to: #10561
[+TASK] Extbase (Core): moved Tx_Extbase_Bootstrap to Tx_Extbase_Core_Bootstrap
Moving Bootstrap to be compliant with FLOW3
Removed obsolete Classes. Resolves: #10704
[+TASK] Extbase: Merged current trunk (r2689) with local modifications into dispatcher branch
Note: This still needs a cleanup and some fixes (see FIXME comments) before it can be merged back to the trunk. Relates to: #10605. Relates to: #10655
[+TASK] Extbase (Configuration): Moved CONFIGURATION_TYPE_* constraints to ConfigurationManagerInterface. Resolves #10604.
[~TASK] Extbase (Configuration): The concrete configuration management strategy gets instanciate only once now.
[+FEATURE] Extbase (MVC): Decoupled framework settings from Dispatcher.
With the new dependency injection feature you can get the Configuration Manager injected by adding the lines
protected $configurationManager;
public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
    $this->configurationManager = $configurationManager;
}
You can get various types of configuration invoking
$this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManager::CONFIGURATION_TYPE_EXTBASE)
where the class constant must be either CONFIGURATION_TYPE_EXTBASE (for Extbase settings), or CONFIGURATION_TYPE_SETTINGS (for the current module/plugin settings), or CONFIGURATION_TYPE_TYPOSCRIPT (for a raw TS array). Resolves #4741.
[~TAKS] Extbase: Removed obsolete code.
[~TASK] Extbase: Added core patch for mod.php (see previous commit).
[+TASK] Extbase: Changed the way a module gets called.
- You can now specify a function name to be invoked by mod.php:
$TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Bootstrap->callModule';
- This requires a core patch.
[~TASK] Extbase: Changed configuration of the RequestHandler class names to TypoScript.
- The request handlers can now be registered in TypoScript with the setting:
   config.tx_extbase.mvc.requestHandlers.[RequestHandlerClassName] = [RequestHandlerClassName].
- There are now two RequestHandlers in Extbase: FrontendRequestHandler and BackendRequestHandler. Common functionality is in the AbstractRequestHandler.
[+API][+FEATURE] Extbase (Utility): Implemented mechanism to register RequestHandlers.
[+TASK] Extbase: Backported Request Handler Resolver.
[~TASK] Extbase: Added "deprecated" annotation to Dispatcher.
[~TASK] Extbase: Added missing comment.
[+BUGFIX] Extbase (Reflection): The ReflectionService now gets injected to the dispatcher. Related to #10146.
[+BUGFIX] Extbase (Reflection): Changed the way the Reflection Service and it's cache gets initialized.
* Removed check for pre-initialized Reflection Service in the Bootstrap.
* Now using a fixed cache key ('ReflectionData').
Related to #10146.
[~TASK] Extbase: First step of the Dispatcher refactoring.
* Added and adapted some Unit Tests.
* Moved the Dispatcher to MVC.
* Added a backwards compatibility Dispatcher on root level.
* Added a Bootstrap class.
* Removed all backend module support for now.
Related to #7153.
[+TASK] Extbase: Added branch for the dispatcher refactoring.

59 files changed:
typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Configuration/ConfigurationManagerInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php
typo3/sysext/extbase/Classes/Core/Bootstrap.php [new file with mode: 0644]
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/ControllerInterface.php
typo3/sysext/extbase/Classes/MVC/Controller/FlashMessages.php
typo3/sysext/extbase/Classes/MVC/Dispatcher.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/MVC/Request.php
typo3/sysext/extbase/Classes/MVC/RequestHandlerInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/MVC/RequestHandlerResolver.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/MVC/RequestInterface.php
typo3/sysext/extbase/Classes/MVC/Response.php
typo3/sysext/extbase/Classes/MVC/ResponseInterface.php
typo3/sysext/extbase/Classes/MVC/Web/AbstractRequestHandler.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/MVC/Web/BackendRequestHandler.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/MVC/Web/FrontendRequestHandler.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/MVC/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/MVC/Web/Routing/UriBuilder.php
typo3/sysext/extbase/Classes/Object/Container/ClassInfo.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/Container/ClassInfoCache.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/Container/ClassInfoFactory.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/Container/Container.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/Container/Exception/CannotInitializeCacheException.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/Container/Exception/TooManyRecursionLevelsException.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/Container/Exception/UnknownObjectException.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Object/Exception/UnknownObject.php [deleted file]
typo3/sysext/extbase/Classes/Object/ObjectManager.php
typo3/sysext/extbase/Classes/Persistence/Backend.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapFactory.php
typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactoryInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Query.php
typo3/sysext/extbase/Classes/Persistence/QueryResult.php
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php
typo3/sysext/extbase/Classes/Reflection/Service.php
typo3/sysext/extbase/Classes/Utility/ExtbaseRequirementsCheck.php
typo3/sysext/extbase/Classes/Utility/Extension.php
typo3/sysext/extbase/Classes/Utility/Localization.php
typo3/sysext/extbase/Tests/Configuration/BackendConfigurationManager_testcase.php
typo3/sysext/extbase/Tests/Configuration/FrontendConfigurationManager_testcase.php
typo3/sysext/extbase/Tests/Fixtures/Dispatcher.php [deleted file]
typo3/sysext/extbase/Tests/MVC/Controller/ActionController_testcase.php
typo3/sysext/extbase/Tests/MVC/Controller/Argument_testcase.php
typo3/sysext/extbase/Tests/MVC/Controller/Arguments_testcase.php
typo3/sysext/extbase/Tests/MVC/DispatcherTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Object/Container/ClassInfoFactoryTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Object/Container/ContainerTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Object/Container/Fixtures/Testclasses.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Utility/Extension_testcase.php
typo3/sysext/extbase/Tests/Validation/ValidatorResolver_testcase.php
typo3/sysext/extbase/ext_autoload.php
typo3/sysext/extbase/ext_emconf.php
typo3/sysext/extbase/ext_tables.php
typo3/sysext/extbase/ext_typoscript_setup.txt

index 2ebf284..970d335 100644 (file)
@@ -29,7 +29,7 @@
  * @subpackage Configuration
  * @version $ID:$
  */
-abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
+abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements t3lib_Singleton {
 
        /**
         * Default backend storage PID
@@ -37,6 +37,17 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
        const DEFAULT_BACKEND_STORAGE_PID = 0;
 
        /**
+        * Storage of the raw TypoScript configuration
+        * @var array
+        */
+       protected $configuration = array();
+
+       /**
+        * @var tslib_cObj
+        */
+       protected $contentObject;
+
+       /**
         * The TypoScript parser
         *
         * @var t3lib_TSparser
@@ -44,40 +55,92 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
        protected $typoScriptParser;
 
        /**
-        * Storage for the settings, loaded by loadSettings()
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * 1st level configuration cache
         *
         * @var array
         */
-       protected $settings;
+       protected $configurationCache = array();
 
        /**
-        * Constructs the configuration manager
-        *
+        * @param Tx_Extbase_Object_ManagerInterface $objectManager
+        * @return void
         */
-       public function __construct() {
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
                $this->typoScriptParser = t3lib_div::makeInstance('t3lib_TSparser');
        }
 
        /**
+        * @param tslib_cObj $contentObject
+        * @return void
+        */
+       public function setContentObject(tslib_cObj $contentObject = NULL) {
+               $this->contentObject = $contentObject;
+       }
+
+       /**
+        * Sets the specified raw configuration coming from the outside.
+        * Note that this is a low level method and only makes sense to be used by Extbase internally.
+        *
+        * @param array $configuration The new configuration
+        * @return void
+        */
+       public function setConfiguration(array $configuration = array()) {
+               // reset 1st level cache
+               $this->configurationCache = array();
+               $this->configuration = $configuration;
+       }
+
+       /**
         * Loads the Extbase Framework configuration.
         *
         * The Extbase framework configuration HAS TO be retrieved using this method, as they are come from different places than the normal settings.
         * Framework configuration is, in contrast to normal settings, needed for the Extbase framework to operate correctly.
         *
-        * @param array $pluginConfiguration The current incoming extbase configuration
+        * @param string $extensionName if specified, the configuration for the given extension will be returned (plugin.tx_extensionname)
+        * @param string $pluginName if specified, the configuration for the given plugin will be returned (plugin.tx_extensionname_pluginname)
         * @return array the Extbase framework configuration
         */
-       public function getFrameworkConfiguration($pluginConfiguration) {
+       public function getConfiguration($extensionName = NULL, $pluginName = NULL) {
+               // 1st level cache
+               if ($extensionName !== NULL) {
+                       $configurationCacheKey = strtolower($extensionName);
+                       if ($pluginName !== NULL) {
+                               $configurationCacheKey .= '_' . strtolower($pluginName);
+                       }
+               } else {
+                       $configurationCacheKey = '_global';
+               }
+               if (isset($this->configurationCache[$configurationCacheKey])) {
+                       return $this->configurationCache[$configurationCacheKey];
+               }
+
                $frameworkConfiguration = array();
                $frameworkConfiguration['persistence']['storagePid'] = self::DEFAULT_BACKEND_STORAGE_PID;
 
-               $setup = $this->loadTypoScriptSetup();
+               $setup = $this->getTypoScriptSetup();
+               if ($extensionName !== NULL) {
+                       $pluginConfiguration = $setup['plugin.']['tx_' . strtolower($extensionName) . '.'];
+                       if ($pluginName !== NULL) {
+                               $pluginSignature = strtolower($extensionName . '_' . $pluginName);
+                               if (is_array($setup['plugin.']['tx_' . $pluginSignature . '.'])) {
+                                       $pluginConfiguration = t3lib_div::array_merge_recursive_overrule($pluginConfiguration, $setup['plugin.']['tx_' . $pluginSignature . '.']);
+                               }
+                       }
+               } else {
+                       $pluginConfiguration = $this->configuration;
+               }
                $extbaseConfiguration = $setup['config.']['tx_extbase.'];
                if (is_array($extbaseConfiguration)) {
                        $extbaseConfiguration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($extbaseConfiguration);
                        $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, $extbaseConfiguration);
                }
-               
+
                if (isset($pluginConfiguration['settings'])) {
                        $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, 'settings');
                }
@@ -94,6 +157,9 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
                $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($pluginConfiguration));
 
                $frameworkConfiguration = $this->getContextSpecificFrameworkConfiguration($frameworkConfiguration);
+
+               // 1st level cache
+               $this->configurationCache[$configurationCacheKey] = $frameworkConfiguration;
                return $frameworkConfiguration;
        }
 
@@ -115,7 +181,7 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
         *
         * @return array the TypoScript setup
         */
-       abstract public function loadTypoScriptSetup();
+       abstract protected function getTypoScriptSetup();
 
        /**
         * Resolves the TypoScript reference for $pluginConfiguration[$setting].
@@ -129,7 +195,7 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
        protected function resolveTyposcriptReference($pluginConfiguration, $setting) {
                if (is_string($pluginConfiguration[$setting]) && substr($pluginConfiguration[$setting], 0, 1) === '<') {
                        $key = trim(substr($pluginConfiguration[$setting], 1));
-                       $setup = $this->loadTypoScriptSetup();
+                       $setup = $this->getTypoScriptSetup();
                        list(, $newValue) = $this->typoScriptParser->getVal($key, $setup);
 
                        unset($pluginConfiguration[$setting]);
index 5a05f19..ba60f39 100644 (file)
@@ -29,7 +29,7 @@
  * @subpackage Configuration
  * @version $ID:$
  */
-class Tx_Extbase_Configuration_BackendConfigurationManager extends Tx_Extbase_Configuration_AbstractConfigurationManager implements t3lib_Singleton {
+class Tx_Extbase_Configuration_BackendConfigurationManager extends Tx_Extbase_Configuration_AbstractConfigurationManager {
 
        /**
         * @var array
@@ -39,9 +39,9 @@ class Tx_Extbase_Configuration_BackendConfigurationManager extends Tx_Extbase_Co
        /**
         * Returns TypoScript Setup array from current Environment.
         *
-        * @return array the TypoScript setup
+        * @return array the raw TypoScript setup
         */
-       public function loadTypoScriptSetup() {
+       public function getTypoScriptSetup() {
                if ($this->typoScriptSetupCache === NULL) {
                        $template = t3lib_div::makeInstance('t3lib_TStemplate');
                                // do not log time-performance information
diff --git a/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php b/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php
new file mode 100644 (file)
index 0000000..bb90467
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+ *  All rights reserved
+ *
+ *  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 configuration manager following the strategy pattern (GoF315). It hides the concrete
+ * implementation of the configuration manager and provides an unified acccess point.
+ *
+ * Use the shutdown() method to drop the concrete implementation.
+ *
+ * @package Extbase
+ * @subpackage Configuration
+ * @version $ID:$
+ */
+class Tx_Extbase_Configuration_ConfigurationManager implements Tx_Extbase_Configuration_ConfigurationManagerInterface {
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * @var Tx_Extbase_Configuration_AbstractConfigurationManager
+        **/
+       protected $concreteConfigurationManager;
+
+       /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+               $this->initializeConcreteConfigurationManager();
+       }
+
+       /**
+        * @return void
+        */
+       protected function initializeConcreteConfigurationManager() {
+               if (TYPO3_MODE === 'FE') {
+                       $this->concreteConfigurationManager = $this->objectManager->get('Tx_Extbase_Configuration_FrontendConfigurationManager');
+               } else {
+                       $this->concreteConfigurationManager = $this->objectManager->get('Tx_Extbase_Configuration_BackendConfigurationManager');
+               }
+       }
+
+       /**
+        * @param tslib_cObj $contentObject
+        * @return void
+        */
+       public function setContentObject(tslib_cObj $contentObject = NULL) {
+               $this->concreteConfigurationManager->setContentObject($contentObject);
+       }
+
+       /**
+        * Sets the specified raw configuration coming from the outside.
+        * Note that this is a low level method and only makes sense to be used by Extbase internally.
+        *
+        * @param array $configuration The new configuration
+        * @return void
+        */
+       public function setConfiguration(array $configuration = array()) {
+               $this->concreteConfigurationManager->setConfiguration($configuration);
+       }
+
+       /**
+        * Returns the specified configuration.
+        * The actual configuration will be merged from different sources in a defined order.
+        *
+        * Note that this is a low level method and only makes sense to be used by Extbase internally.
+        *
+        * @param string $configurationType The kind of configuration to fetch - must be one of the CONFIGURATION_TYPE_* constants
+        * @param string $pluginSignature if specified, the configuration for the given plugin will be returned. Format: strtolower($extensionName . '_' . $pluginName)
+        * @return array The configuration
+        */
+       public function getConfiguration($configurationType, $extensionName = NULL, $pluginName = NULL) {
+               switch ($configurationType) {
+                       case self::CONFIGURATION_TYPE_SETTINGS :
+                               $configuration = $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
+                               return $configuration['settings'];
+                       case self::CONFIGURATION_TYPE_FRAMEWORK :
+                               return $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
+                       case self::CONFIGURATION_TYPE_FULL_TYPOSCRIPT :
+                               return $this->concreteConfigurationManager->getTypoScriptSetup();
+                       default :
+                               throw new Tx_Extbase_Configuration_Exception_InvalidConfigurationTypeException('Invalid configuration type "' . $configurationType . '"', 1206031879);
+               }
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Configuration/ConfigurationManagerInterface.php b/typo3/sysext/extbase/Classes/Configuration/ConfigurationManagerInterface.php
new file mode 100644 (file)
index 0000000..640264a
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+ *  All rights reserved
+ *
+ *  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!
+ ***************************************************************/
+
+/**
+ *
+ *
+ * @package Extbase
+ * @subpackage Configuration
+ * @version $ID:$
+ */
+interface Tx_Extbase_Configuration_ConfigurationManagerInterface extends t3lib_Singleton {
+
+       const CONFIGURATION_TYPE_FRAMEWORK = 'Framework';
+       const CONFIGURATION_TYPE_SETTINGS = 'Settings';
+       const CONFIGURATION_TYPE_FULL_TYPOSCRIPT = 'FullTypoScript';
+
+       /**
+        * @param tslib_cObj $contentObject
+        * @return void
+        */
+       public function setContentObject(tslib_cObj $contentObject = NULL);
+
+       /**
+        * Returns the specified configuration.
+        * The actual configuration will be merged from different sources in a defined order.
+        *
+        * Note that this is a low level method and only makes sense to be used by Extbase internally.
+        *
+        * @param string $configurationType The kind of configuration to fetch - must be one of the CONFIGURATION_TYPE_* constants
+        * @return array The configuration
+        */
+       public function getConfiguration($configurationType);
+
+       /**
+        * Sets the specified raw configuration coming from the outside.
+        * Note that this is a low level method and only makes sense to be used by Extbase internally.
+        *
+        * @param array $configuration The new configuration
+        * @return void
+        */
+       public function setConfiguration(array $configuration = array());
+
+}
+?>
\ No newline at end of file
index ad03677..8e889ca 100644 (file)
 class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_Configuration_AbstractConfigurationManager {
 
        /**
-        * @var tslib_cObj
-        */
-       protected $contentObject;
-
-       /**
-        * @param tslib_cObj $contentObject
-        * @return void
-        */
-       public function setContentObject(tslib_cObj $contentObject) {
-               $this->contentObject = $contentObject;
-       }
-
-       /**
         * Returns TypoScript Setup array from current Environment.
         *
-        * @return array the TypoScript setup
+        * @return array the raw TypoScript setup
         */
-       public function loadTypoScriptSetup() {
+       public function getTypoScriptSetup() {
                return $GLOBALS['TSFE']->tmpl->setup;
        }
 
@@ -107,8 +94,9 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
         * @return array the framework configuration with overridden data from typoscript
         */
        protected function overrideConfigurationFromPlugin(array $frameworkConfiguration) {
-               $setup = $this->loadTypoScriptSetup();
-               $pluginConfiguration =  $setup['plugin.']['tx_' . strtolower($frameworkConfiguration['extensionName'] . '_' . $frameworkConfiguration['pluginName']) . '.'];
+               $setup = $this->getTypoScriptSetup();
+               $pluginSignature = strtolower($frameworkConfiguration['extensionName'] . '_' . $frameworkConfiguration['pluginName']);
+               $pluginConfiguration =  $setup['plugin.']['tx_' . $pluginSignature . '.'];
                if (is_array($pluginConfiguration)) {
                        $pluginConfiguration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($pluginConfiguration);
                        $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $pluginConfiguration, 'settings');
@@ -238,4 +226,4 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
                return $frameworkConfiguration;
        }
 }
-?>
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Core/Bootstrap.php b/typo3/sysext/extbase/Classes/Core/Bootstrap.php
new file mode 100644 (file)
index 0000000..18beaeb
--- /dev/null
@@ -0,0 +1,253 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Jochen Rau <jochen.rau@typoplanet.de>
+*  All rights reserved
+*
+*  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!
+***************************************************************/
+
+/**
+ * Creates a request an dispatches it to the controller which was specified
+ * by TS Setup, Flexform and returns the content to the v4 framework.
+ *
+ * This class is the main entry point for extbase extensions.
+ *
+ * @package Extbase
+ * @version $ID:$
+ */
+class Tx_Extbase_Core_Bootstrap {
+
+       /**
+        * Back reference to the parent content object
+        * This has to be public as it is set directly from TYPO3
+        *
+        * @var tslib_cObj
+        */
+       public $cObj;
+
+       /**
+        * The application context
+        * @var string
+        */
+       protected $context;
+
+       /**
+        * @var Tx_Extbase_Configuration_ConfigurationManager
+        */
+       protected $configurationManager;
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * @var t3lib_cache_Manager
+        */
+       protected $cacheManager;
+
+       /**
+        * @var Tx_Extbase_Reflection_Service
+        */
+       protected $reflectionService;
+
+       /**
+        * @var Tx_Extbase_Persistence_Manager
+        */
+       protected $persistenceManager;
+
+       /**
+        * @var boolean
+        */
+       protected $isInitialized = FALSE;
+
+       /**
+        * Explicitly initializes all necessary Extbase objects by invoking the various initialize* methods.
+        *
+        * Usually this method is only called from unit tests or other applications which need a more fine grained control over
+        * the initialization and request handling process. Most other applications just call the run() method.
+        *
+        * @param array $configuration The TS configuration array
+        * @return void
+        * @see run()
+        * @api
+        */
+       public function initialize($configuration) {
+               $this->initializeClassLoader();
+               $this->initializeObjectManager();
+               $this->initializeConfiguration($configuration);
+               // $this->initializeExtensions();
+               $this->initializeCache();
+               $this->initializeReflection();
+               // $this->initializeObjectContainer();
+               $this->initializePersistence();
+               $this->initializeBackwardsCompatibility();
+               // $this->initializeSession();
+               // $this->initializeLocale();
+               $this->isInitialized = TRUE;
+       }
+
+       /**
+        * Initializes the autoload mechanism of Extbase. This is supplement to the core autoloader.
+        *
+        * @return void
+        * @see initialize()
+        */
+       protected function initializeClassLoader() {
+               if (!class_exists('Tx_Extbase_Utility_ClassLoader', FALSE)) {
+                       require(t3lib_extmgm::extPath('extbase') . 'Classes/Utility/ClassLoader.php');
+               }
+
+               $classLoader = new Tx_Extbase_Utility_ClassLoader();
+               spl_autoload_register(array($classLoader, 'loadClass'));
+       }
+
+       /**
+        * Initializes the Object framework.
+        *
+        * @return void
+        * @see initialize()
+        */
+       protected function initializeObjectManager() {
+               $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
+               // $this->objectManager->injectClassLoader($this->classLoader);
+               // $this->objectManager->injectConfigurationManager($this->configurationManager);
+               // $this->objectManager->setContext($this->context);
+
+               // $this->objectManager->initialize();
+       }
+
+       /**
+        * Initializes the Object framework.
+        *
+        * @return void
+        * @see initialize()
+        */
+       public function initializeConfiguration($configuration) {
+               $this->configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_ConfigurationManager');
+               $this->configurationManager->setContentObject($this->cObj);
+               $this->configurationManager->setConfiguration($configuration);
+       }
+
+       /**
+        * Initializes the cache framework
+        *
+        * @return void
+        * @see initialize()
+        */
+       protected function initializeCache() {
+               t3lib_cache::initializeCachingFramework();
+               $this->cacheManager = $GLOBALS['typo3CacheManager'];
+               try {
+                       $this->cacheManager->getCache('cache_extbase_reflection');
+               } catch (t3lib_cache_exception_NoSuchCache $exception) {
+                       $GLOBALS['typo3CacheFactory']->create(
+                               'cache_extbase_reflection',
+                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'],
+                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'],
+                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']
+                       );
+               }
+       }
+
+       /**
+        * Initializes the Reflection Service
+        *
+        * @return void
+        * @see initialize()
+        */
+       protected function initializeReflection() {
+               $this->reflectionService = $this->objectManager->get('Tx_Extbase_Reflection_Service');
+               $this->reflectionService->setDataCache($this->cacheManager->getCache('cache_extbase_reflection'));
+               $this->reflectionService->initialize();
+       }
+
+       /**
+        * Initializes the persistence framework
+        *
+        * @return void
+        * @see initialize()
+        */
+       public function initializePersistence() {
+               $this->persistenceManager = $this->objectManager->get('Tx_Extbase_Persistence_Manager'); // singleton
+       }
+
+       /**
+        * Initializes the backwards compatibility. This is necessary because the
+        * old Dispatcher provided several static methods.
+        *
+        * @return void
+        * @see initialize()
+        */
+       protected function initializeBackwardsCompatibility() {
+               $dispatcher = t3lib_div::makeInstance('Tx_Extbase_Dispatcher');
+               $dispatcher->injectConfigurationManager($this->configurationManager);
+               $dispatcher->injectPersistenceManager($this->persistenceManager);
+       }
+
+       /**
+        * Runs the the Extbase Framework by resolving an appropriate Request Handler and passing control to it.
+        * If the Framework is not initialized yet, it will be initialized.
+        *
+        * @param string $content The content
+        * @param array $configuration The TS configuration array
+        * @return string $content The processed content
+        * @api
+        */
+       public function run($content, $configuration) {
+               //var_dump(Tx_Extbase_Utility_Extension::createAutoloadRegistryForExtension('extbase', t3lib_extMgm::extPath('extbase'), array(
+               //      'tx_extbase_basetestcase' => '$extensionClassesPath . \'../Tests/BaseTestCase.php\''
+               //)));
+               //die("autoload registry");
+
+               if ($this->isInitialized !== TRUE) {
+                       $this->initialize($configuration);
+               }
+
+               $requestHandlerResolver = $this->objectManager->get('Tx_Extbase_MVC_RequestHandlerResolver');
+               $requestHandler = $requestHandlerResolver->resolveRequestHandler();
+               $requestHandler->setContentObject($this->cObj);
+
+               $response = $requestHandler->handleRequest();
+
+               $this->persistenceManager->persistAll();
+               $this->reflectionService->shutdown();
+               // $this->objectManager->shutdown();
+               if (count($response->getAdditionalHeaderData()) > 0) {
+                       $GLOBALS['TSFE']->additionalHeaderData[] = implode('', $response->getAdditionalHeaderData());
+               }
+               $response->sendHeaders();
+               return $response->getContent();
+       }
+
+        /**
+         * This method forwards the call to run(). This method is invoked by the mod.php
+         * function of TYPO3.
+         *
+         * @return TRUE
+         * @see run()
+         **/
+       public function callModule($moduleName) {
+               $configuration = array();
+               $configuration['module.']['tx_extbase.']['moduleName'] = $moduleName;
+               $this->run('', $configuration);
+               return TRUE;
+       }
+}
+?>
\ No newline at end of file
index 4d637cd..3eeb864 100644 (file)
 ***************************************************************/
 
 /**
- * Creates a request an dispatches it to the controller which was specified
- * by TS Setup, Flexform and returns the content to the v4 framework.
+ * This class was the main entry point for extbase extensions before v1.3.0. It was replaced by the class
+ * Tx_Extbase_Bootstrap in combination with the class Tx_Extbase_MVC_Dispatcher to separate responsibilities.
  *
- * This class is the main entry point for extbase extensions.
+ * The use of static functions is deprecated since 1.3.0 and will be removed in 1.5.0.
  *
  * @package Extbase
  * @version $ID:$
+ * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0
+ * @see Tx_Extbase_Bootstrap, Tx_Extbase_MVC_Dispatcher
  */
 class Tx_Extbase_Dispatcher {
 
        /**
-        * Back reference to the parent content object
-        * This has to be public as it is set directly from TYPO3
-        *
-        * @var tslib_cObj
-        */
-       public $cObj;
-
-       /**
-        * @var Tx_Extbase_Utility_ClassLoader
-        */
-       protected $classLoader;
-
-       /**
-        * @var Tx_Extbase_Configuration_AbstractConfigurationManager
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
         */
        protected static $configurationManager;
 
        /**
-        * @var t3lib_cache_Manager
-        */
-       protected $cacheManager;
-
-       /**
-        * @var Tx_Extbase_Reflection_Service
-        */
-       protected static $reflectionService;
-
-       /**
         * @var Tx_Extbase_Persistence_Manager
         */
        protected static $persistenceManager;
 
        /**
-        * The configuration for the Extbase framework
-        * @var array
-        */
-       protected static $extbaseFrameworkConfiguration;
-
-       /**
-        * @var Tx_Extbase_Object_ObjectManager
-        */
-       protected $objectManager;
-
-       /**
-        * Constructs this Dispatcher and registers the autoloader
-        */
-       public function __construct() {
-               t3lib_cache::initializeCachingFramework();
-               $this->initializeClassLoader();
-               $this->initializeObjectManager();
-               $this->initializeCache();
-               $this->initializeReflection();
-       }
-
-       /**
-        * Creates a request an dispatches it to a controller.
-        *
-        * @param string $content The content
-        * @param array $configuration The TS configuration array
-        * @return string $content The processed content
-        */
-       public function dispatch($content, $configuration) {
-               // FIXME Remove the next lines. These are only there to generate the ext_autoload.php file
-               //$extutil = new Tx_Extbase_Utility_Extension;
-               //$extutil->createAutoloadRegistryForExtension('extbase', t3lib_extMgm::extPath('extbase'));
-               //$extutil->createAutoloadRegistryForExtension('fluid', t3lib_extMgm::extPath('fluid'));
-
-               $this->timeTrackPush('Extbase is called.','');
-               $this->timeTrackPush('Extbase gets initialized.','');
-
-               if (!is_array($configuration)) {
-                       t3lib_div::sysLog('Extbase was not able to dispatch the request. No configuration.', 'extbase', t3lib_div::SYSLOG_SEVERITY_ERROR);
-                       return $content;
-               }
-
-               $this->initializeConfigurationManagerAndFrameworkConfiguration($configuration);
-
-               $requestBuilder = $this->objectManager->get('Tx_Extbase_MVC_Web_RequestBuilder');
-               $request = $requestBuilder->initialize(self::$extbaseFrameworkConfiguration);
-               $request = $requestBuilder->build();
-               if (isset($this->cObj->data) && is_array($this->cObj->data)) {
-                       // we need to check the above conditions as cObj is not available in Backend.
-                       $request->setContentObjectData($this->cObj->data);
-                       if ($this->isCacheable($request->getControllerName(), $request->getControllerActionName())) {
-                               $request->setIsCached(TRUE);
-                       } else {
-                               if ($this->cObj->getUserObjectType() === tslib_cObj::OBJECTTYPE_USER) {
-                                       $this->cObj->convertToUserIntObject();
-                                       // tslib_cObj::convertToUserIntObject() will recreate the object, so we have to stop the request here
-                                       return;
-                               }
-                               $request->setIsCached(FALSE);
-                       }
-               }
-               $response = $this->objectManager->get('Tx_Extbase_MVC_Web_Response');
-
-               // Request hash service
-               $requestHashService = $this->objectManager->get('Tx_Extbase_Security_Channel_RequestHashService'); // singleton
-               $requestHashService->verifyRequest($request);
-
-               $persistenceManager = self::getPersistenceManager();
-
-               $this->timeTrackPull();
-
-               $this->timeTrackPush('Extbase dispatches request.','');
-               $dispatchLoopCount = 0;
-               while (!$request->isDispatched()) {
-                       if ($dispatchLoopCount++ > 99) throw new Tx_Extbase_MVC_Exception_InfiniteLoop('Could not ultimately dispatch the request after '  . $dispatchLoopCount . ' iterations.', 1217839467);
-                       $controller = $this->getPreparedController($request);
-                       try {
-                               $controller->processRequest($request, $response);
-                       } catch (Tx_Extbase_MVC_Exception_StopAction $ignoredException) {
-                       }
-               }
-               $this->timeTrackPull();
-
-               $this->timeTrackPush('Extbase persists all changes.','');
-               $flashMessages = $this->objectManager->get('Tx_Extbase_MVC_Controller_FlashMessages'); // singleton
-               $flashMessages->persist();
-               $persistenceManager->persistAll();
-               $this->timeTrackPull();
-
-               self::$reflectionService->shutdown();
-
-               if (count($response->getAdditionalHeaderData()) > 0) {
-                       $GLOBALS['TSFE']->additionalHeaderData[$request->getControllerExtensionName()] = implode("\n", $response->getAdditionalHeaderData());
-               }
-               $response->sendHeaders();
-               $this->timeTrackPull();
-               return $response->getContent();
-       }
-
-       /**
-        * Determines whether the current action can be cached
-        *
-        * @param string $controllerName
-        * @param string $actionName
-        * @return boolean TRUE if the given action should be cached, otherwise FALSE
-        */
-       protected function isCacheable($controllerName, $actionName) {
-               if (isset(self::$extbaseFrameworkConfiguration['switchableControllerActions'][$controllerName]['nonCacheableActions'])
-                       && in_array($actionName, t3lib_div::trimExplode(',', self::$extbaseFrameworkConfiguration['switchableControllerActions'][$controllerName]['nonCacheableActions']))) {
-                               return FALSE;
-               }
-               return TRUE;
-       }
-
-       /**
-        * Initializes the autoload mechanism of Extbase. This is supplement to the core autoloader.
-        *
-        * @return void
-        */
-       protected function initializeClassLoader() {
-               if (!class_exists('Tx_Extbase_Utility_ClassLoader')) {
-                       require(t3lib_extmgm::extPath('extbase') . 'Classes/Utility/ClassLoader.php');
-               }
-
-               $classLoader = new Tx_Extbase_Utility_ClassLoader();
-               spl_autoload_register(array($classLoader, 'loadClass'));
-       }
-       
-       /**
-        * Initializes the objectManager which's taking care of building our objects
-        * @return void
-        */
-       protected function initializeObjectManager() {
-               $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
-       }
-
-       /**
-        * Initializes the configuration manager and the Extbase settings
+        * Injects the Configuration Manager
         *
-        * @param $configuration The current incoming configuration
+        * @param Tx_Extbase_Configuration_ConfigurationManagerInterface An instance of the Configuration Manager
         * @return void
         */
-       protected function initializeConfigurationManagerAndFrameworkConfiguration($configuration) {
-               if (TYPO3_MODE === 'FE') {
-                       self::$configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_FrontendConfigurationManager');
-                       self::$configurationManager->setContentObject($this->cObj);
-               } else {
-                       self::$configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_BackendConfigurationManager');
-               }
-               self::$extbaseFrameworkConfiguration = self::$configurationManager->getFrameworkConfiguration($configuration);
+       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
+               self::$configurationManager = $configurationManager;
        }
 
        /**
-        * Initializes the cache framework
+        * Injects the Persistence Manager
         *
+        * @param Tx_Extbase_Persistence_Manager An instance of the Persistence Manager
         * @return void
         */
-       protected function initializeCache() {
-               $this->cacheManager = $GLOBALS['typo3CacheManager'];
-               try {
-                       $this->cacheManager->getCache('cache_extbase_reflection');
-               } catch (t3lib_cache_exception_NoSuchCache $exception) {
-                       $GLOBALS['typo3CacheFactory']->create(
-                               'cache_extbase_reflection',
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']
-                       );
-               }
+       public function injectPersistenceManager(Tx_Extbase_Persistence_Manager $persistenceManager) {
+               self::$persistenceManager = $persistenceManager;
        }
 
        /**
-        * Initializes the Reflection Service
-        *
-        * @return void
-        */
-       protected function initializeReflection() {
-               self::$reflectionService = $this->objectManager->get('Tx_Extbase_Reflection_Service');
-               self::$reflectionService->setCache($this->cacheManager->getCache('cache_extbase_reflection'));
-               if (!self::$reflectionService->isInitialized()) {
-                       self::$reflectionService->initialize();
-               }
-       }
-
-       /**
-        * Builds and returns a controller
-        *
-        * @param Tx_Extbase_MVC_Web_Request $request
-        * @return Tx_Extbase_MVC_Controller_ControllerInterface The prepared controller
-        */
-       protected function getPreparedController(Tx_Extbase_MVC_Web_Request $request) {
-               $controllerObjectName = $request->getControllerObjectName();
-               $controller = $this->objectManager->get($controllerObjectName);
-               if (!$controller instanceof Tx_Extbase_MVC_Controller_ControllerInterface) {
-                       throw new Tx_Extbase_MVC_Exception_InvalidController('Invalid controller "' . $request->getControllerObjectName() . '". The controller must implement the Tx_Extbase_MVC_Controller_ControllerInterface.', 1202921619);
-               }
-
-               $controller->setSettings(is_array(self::$extbaseFrameworkConfiguration['settings']) ? self::$extbaseFrameworkConfiguration['settings'] : array());
-
-               $flashMessageContainer = $this->objectManager->get('Tx_Extbase_MVC_Controller_FlashMessages'); // singleton
-               $flashMessageContainer->reset();
-               $controller->injectFlashMessageContainer($flashMessageContainer);
-
-               return $controller;
-       }
-
-       /**
-        * This function prepares and returns the Persistance Manager
-        *
-        * @return Tx_Extbase_Persistence_Manager A (singleton) instance of the Persistence Manager
-        */
-       public static function getPersistenceManager() {
-               if (self::$persistenceManager === NULL) {
-                       self::$persistenceManager = Tx_Container_Container::getContainer()->getInstance('Tx_Extbase_Persistence_Manager');
-               }
-
-               return self::$persistenceManager;
-       }
-
-       /**
-        * This function returns the Configuration Manager. It is instanciated for
-        * each call to dispatch() only once.
+        * Returns the Configuration Manager.
         *
         * @return Tx_Extbase_Configuration_Manager An instance of the Configuration Manager
+        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0
         */
        public static function getConfigurationManager() {
+               t3lib_div::logDeprecatedFunction();
                return self::$configurationManager;
        }
 
        /**
-        * This function returns the settings of Extbase
-        *
-        * @return array The settings
-        */
-       public static function getExtbaseFrameworkConfiguration() {
-               return self::$extbaseFrameworkConfiguration;
-       }
-
-       /**
-        * Calls an Extbase Backend module.
-        *
-        * @param string $module The name of the module
-        * @return void
-        */
-       public function callModule($module) {
-               if (isset($GLOBALS['TBE_MODULES']['_configuration'][$module])) {
-                       $config = $GLOBALS['TBE_MODULES']['_configuration'][$module];
-
-                       // Check permissions and exit if the user has no permission for entry
-                       $GLOBALS['BE_USER']->modAccess($config, TRUE);
-                       if (t3lib_div::_GP('id')) {
-                               // Check page access
-                               $id = t3lib_div::_GP('id');
-                               $permClause = $GLOBALS['BE_USER']->getPagePermsClause(TRUE);
-                               $access = is_array(t3lib_BEfunc::readPageAccess($id, $permClause));
-                               if (!$access) {
-                                       t3lib_BEfunc::typo3PrintError('No Access', 'You don\'t have access to this page', 0);
-                               }
-                       }
-
-                       // Resolve the controller/action to use
-                       $controllerAction = $this->resolveControllerAction($module);
-
-                       // As for SCbase modules, output of the controller/action pair should be echoed
-                       echo $this->transfer($module, $controllerAction['controllerName'], $controllerAction['actionName']);
-                       return TRUE;
-               } else {
-                       return FALSE;
-               }
-       }
-
-       /**
-        * Resolves the controller and action to use for current call.
-        * This takes into account any function menu that has being called.
+        * Returns the Persistance Manager
         *
-        * @param string $module The name of the module
-        * @return array The controller/action pair to use for current call
+        * @return Tx_Extbase_Persistence_Manager An instance of the Persistence Manager
+        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0
         */
-       protected function resolveControllerAction($module) {
-               $configuration = $GLOBALS['TBE_MODULES']['_configuration'][$module];
-               $fallbackControllerAction = $this->getFallbackControllerAction($configuration);
-
-                       // Extract dispatcher settings from request
-               $argumentPrefix = strtolower('tx_' . $configuration['extensionName'] . '_' . $configuration['name']);
-               $dispatcherParameters = t3lib_div::_GPmerged($argumentPrefix);
-               $dispatcherControllerAction = $this->getDispatcherControllerAction($configuration, $dispatcherParameters);
-
-                       // Extract module function settings from request
-               $moduleFunctionControllerAction = $this->getModuleFunctionControllerAction($module, $fallbackControllerAction['controllerName']);
-
-                       // Dispatcher controller/action has precedence over default controller/action
-               $controllerAction = t3lib_div::array_merge_recursive_overrule($fallbackControllerAction, $dispatcherControllerAction, FALSE, FALSE);
-                       // Module function controller/action has precedence
-               $controllerAction = t3lib_div::array_merge_recursive_overrule($controllerAction, $moduleFunctionControllerAction, FALSE, FALSE);
-
-               return $controllerAction;
-       }
-
-       /**
-        * Returns the fallback controller/action pair to be used when request does not contain
-        * any controller/action to be used or the provided parameters are not valid.
-        *
-        * @param array $configuration The module configuration
-        * @return array The controller/action pair
-        */
-       protected function getFallbackControllerAction($configuration) {
-                       // Extract module settings from its registration in ext_tables.php
-               $controllers = array_keys($configuration['controllerActions']);
-               $defaultController = array_shift($controllers);
-               $actions = t3lib_div::trimExplode(',', $configuration['controllerActions'][$defaultController], TRUE);
-               $defaultAction = $actions[0];
-
-               return array(
-                       'controllerName' => $defaultController,
-                       'actionName' => $defaultAction,
-               );
-       }
-
-       /**
-        * Returns the controller/action pair that was specified by the request if it is valid,
-        * otherwise, will just return a blank controller/action pair meaning the default
-        * controller/action should be used instead.
-        *
-        * @param array $configuration The module configuration
-        * @param array $dispatcherParameters The dispatcher parameters
-        * @return array The controller/action pair
-        */
-       protected function getDispatcherControllerAction($configuration, $dispatcherParameters) {
-               $controllerAction = array(
-                       'controllerName' => '',
-                       'actionName' => '',
-               );
-
-               if (!isset($dispatcherParameters['controllerName'])) {
-                               // Early return: should use fallback controller/action
-                       return $controllerAction;
-               }
-
-                       // Extract configured controllers from module's registration in ext_tables.php
-               $controllers = array_keys($configuration['controllerActions']);
-
-               $controller = $dispatcherParameters['controllerName'];
-               if (in_array($controller, $controllers)) {
-                               // Update return value as selected controller is valid
-                       $controllerAction['controllerName'] = $controller;
-                       $actions = t3lib_div::trimExplode(',', $configuration['controllerActions'][$controller], TRUE);
-                       if (isset($dispatcherParameters['actionName'])) {
-                                       // Extract configured actions for selected controllers
-                               $action = $dispatcherParameters['actionName'];
-                               if (in_array($action, $actions)) {
-                                               // Requested action is valid for selected controller
-                                       $controllerAction['actionName'] = $action;
-                               } else {
-                                               // Use first action of selected controller as fallback action
-                                       $controllerAction['actionName'] = $actions[0];
-                               }
-                       } else {
-                                       // Use first action of selected controller as fallback action
-                               $controllerAction['actionName'] = $actions[0];
-                       }
-               }
-
-               return $controllerAction;
-       }
-
-       /**
-        * Returns the controller/action pair to use if a module function parameter is found
-        * in the request, otherwise, will just return a blank controller/action pair.
-        *
-        * @param string $module The name of the module
-        * @param string $defaultController The module's default controller
-        * @return array The controller/action pair
-        */
-       protected function getModuleFunctionControllerAction($module, $defaultController) {
-               $controllerAction = array(
-                       'controllerName' => '',
-                       'actionName' => '',
-               );
-
-               $set = t3lib_div::_GP('SET');
-               if (!$set) {
-                               // Early return
-                       return $controllerAction;
-               }
-
-               $moduleFunction = $set['function'];
-               $matches = array();
-               if (preg_match('/^(.*)->(.*)$/', $moduleFunction, $matches)) {
-                       $controllerAction['controllerName'] = $matches[1];
-                       $controllerAction['actionName'] = $matches[2];
-               } else {
-                               // Support for external SCbase module function rendering
-                       $functions = $GLOBALS['TBE_MODULES_EXT']['_configuration'][$module]['MOD_MENU']['function'];
-                       if (isset($functions[$moduleFunction])) {
-                               $controllerAction['controllerName'] = $defaultController;
-                               $controllerAction['actionName'] = 'extObj';
-                       }
-               }
-
-               return $controllerAction;
-       }
-
-       /**
-        * Transfers the request to an Extbase backend module, calling
-        * a given controller/action.
-        *
-        * @param string $module The name of the module
-        * @param string $controller The controller to use
-        * @param string $action The controller's action to execute
-        * @return string The module rendered view
-        */
-       protected function transfer($module, $controller, $action) {
-               $config = $GLOBALS['TBE_MODULES']['_configuration'][$module];
-
-               $extbaseConfiguration = array(
-                       'userFunc' => 'tx_extbase_dispatcher->dispatch',
-                       'pluginName' => $module,
-                       'extensionName' => $config['extensionName'],
-                       'controller' => $controller,
-                       'action' => $action,
-                       'switchableControllerActions.' => array(),
-                       'settings' => '< module.tx_' . strtolower($config['extensionName']) . '.settings',
-                       'persistence' => '< module.tx_' . strtolower($config['extensionName']) . '.persistence',
-                       'view' => '< module.tx_' . strtolower($config['extensionName']) . '.view',
-               );
-
-               $i = 1;
-               foreach ($config['controllerActions'] as $controller => $actions) {
-                               // Add an "extObj" action for the default controller to handle external
-                               // SCbase modules which add function menu entries
-                       if ($i == 1) {
-                               $actions .= ',extObj';
-                       }
-                       $extbaseConfiguration['switchableControllerActions.'][$controller . '.'] = array(
-                               'controller' => $controller,
-                               'actions' => $actions,
-                       );
-                       $i++;
-               }
-
-                       // BACK_PATH is the path from the typo3/ directory from within the
-                       // directory containing the controller file. We are using mod.php dispatcher
-                       // and thus we are already within typo3/ because we call typo3/mod.php
-               $GLOBALS['BACK_PATH'] = '';
-               return $this->dispatch('', $extbaseConfiguration);
+       public static function getPersistenceManager() {
+               t3lib_div::logDeprecatedFunction();
+               return self::$persistenceManager;
        }
 
        /**
-        * Push some information to time tracking if in Frontend
+        * Returns the settings of Extbase
         *
-        * @param string $name
-        * @todo correct variable names
-        * @return void
-        */
-       protected function timeTrackPush($name, $param2) {
-               if (isset($GLOBALS['TT'])) {
-                       $GLOBALS['TT']->push($name, $param2);
-               }
-       }
-
-       /**
-        * Time track pull
-        * @todo complete documentation of this method.
+        * @return array The configuration for the Extbase framework
+        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0
         */
-       protected function timeTrackPull() {
-               if (isset($GLOBALS['TT'])) {
-                       $GLOBALS['TT']->pull();
-               }
+       public static function getExtbaseFrameworkConfiguration() {
+               t3lib_div::logDeprecatedFunction();
+               return self::$configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
        }
 
 }
index 52d2514..90e896d 100644 (file)
@@ -33,7 +33,7 @@
  * @version $ID:$
  * @api
  */
-abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbase_MVC_Controller_ControllerInterface {
+abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbase_MVC_Controller_ControllerInterface, t3lib_Singleton {
        /**
         * @var Tx_Extbase_Object_ObjectManagerInterface
         */
@@ -126,31 +126,34 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
        protected $flashMessageContainer;
 
        /**
+        * @var Tx_Extbase_Configuration_ConfigurationManager
+        */
+       protected $configurationManager;
+
+       /**
         * Constructs the controller.
         */
        public function __construct() {
                list(, $this->extensionName) = explode('_', get_class($this));
-
        }
 
        /**
-        * Injects the property mapper
-        *
-        * @param Tx_Extbase_Property_Mapper $propertyMapper The property mapper
+        * @param Tx_Extbase_Configuration_ConfigurationManager $configurationManager
         * @return void
         */
-       public function injectPropertyMapper(Tx_Extbase_Property_Mapper $propertyMapper) {
-               $this->propertyMapper = $propertyMapper;
+       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManager $configurationManager) {
+               $this->configurationManager = $configurationManager;
+               $this->settings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
        }
 
        /**
-        * Injects the settings of the extension.
+        * Injects the property mapper
         *
-        * @param array $settings Settings container of the current extension
+        * @param Tx_Extbase_Property_Mapper $propertyMapper The property mapper
         * @return void
         */
-       public function setSettings(array $settings) {
-               $this->settings = $settings;
+       public function injectPropertyMapper(Tx_Extbase_Property_Mapper $propertyMapper) {
+               $this->propertyMapper = $propertyMapper;
        }
 
        /**
@@ -196,7 +199,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
         * @return boolean TRUE if this request type is supported, otherwise FALSE
         * @api
         */
-       public function canProcessRequest(Tx_Extbase_MVC_Request $request) {
+       public function canProcessRequest(Tx_Extbase_MVC_RequestInterface $request) {
                foreach ($this->supportedRequestTypes as $supportedRequestType) {
                        if ($request instanceof $supportedRequestType) return TRUE;
                }
@@ -212,7 +215,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
         * @throws Tx_Extbase_MVC_Exception_UnsupportedRequestType if the controller doesn't support the current request type
         * @api
         */
-       public function processRequest(Tx_Extbase_MVC_Request $request, Tx_Extbase_MVC_Response $response) {
+       public function processRequest(Tx_Extbase_MVC_RequestInterface $request, Tx_Extbase_MVC_ResponseInterface $response) {
                if (!$this->canProcessRequest($request)) throw new Tx_Extbase_MVC_Exception_UnsupportedRequestType(get_class($this) . ' does not support requests of type "' . get_class($request) . '". Supported types are: ' . implode(' ', $this->supportedRequestTypes) , 1187701131);
 
                $this->request = $request;
@@ -322,7 +325,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
                $this->response->setHeader('Location', (string)$uri);
                throw new Tx_Extbase_MVC_Exception_StopAction();
        }
-       
+
        /**
         * Adds the base uri if not already in place.
         *
index 3addc62..b5930c3 100644 (file)
@@ -110,7 +110,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
         * @param Tx_Extbase_MVC_Request $request The current request
         * @return boolean TRUE if this request type is supported, otherwise FALSE
         */
-       public function canProcessRequest(Tx_Extbase_MVC_Request $request) {
+       public function canProcessRequest(Tx_Extbase_MVC_RequestInterface $request) {
                return parent::canProcessRequest($request);
 
        }
@@ -122,7 +122,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
         * @param Tx_Extbase_MVC_Response $response The response, modified by this handler
         * @return void
         */
-       public function processRequest(Tx_Extbase_MVC_Request $request, Tx_Extbase_MVC_Response $response) {
+       public function processRequest(Tx_Extbase_MVC_RequestInterface $request, Tx_Extbase_MVC_ResponseInterface $response) {
                if (!$this->canProcessRequest($request)) throw new Tx_Extbase_MVC_Exception_UnsupportedRequestType(get_class($this) . ' does not support requests of type "' . get_class($request) . '". Supported types are: ' . implode(' ', $this->supportedRequestTypes) , 1187701131);
 
                $this->request = $request;
@@ -282,8 +282,23 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
                }
                $view->setControllerContext($this->controllerContext);
 
-               // Template Path Override
-               $extbaseFrameworkConfiguration = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
+               $this->setViewConfiguration($view);
+
+               if (method_exists($view, 'injectSettings')) {
+                       $view->injectSettings($this->settings);
+               }
+               $view->initializeView(); // In FLOW3, solved through Object Lifecycle methods, we need to call it explicitely
+               $view->assign('settings', $this->settings); // same with settings injection.
+               return $view;
+       }
+
+       /**
+        * @param Tx_Extbase_MVC_View_ViewInterface $view
+        * @return void
+        */
+       protected function setViewConfiguration(Tx_Extbase_MVC_View_ViewInterface $view) {
+                       // Template Path Override
+               $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                if (isset($extbaseFrameworkConfiguration['view']['templateRootPath'])
                        && strlen($extbaseFrameworkConfiguration['view']['templateRootPath']) > 0
                        && method_exists($view, 'setTemplateRootPath')) {
@@ -299,13 +314,6 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
                        && method_exists($view, 'setPartialRootPath')) {
                        $view->setPartialRootPath(t3lib_div::getFileAbsFileName($extbaseFrameworkConfiguration['view']['partialRootPath']));
                }
-
-               if (method_exists($view, 'injectSettings')) {
-                       $view->injectSettings($this->settings);
-               }
-               $view->initializeView(); // In FLOW3, solved through Object Lifecycle methods, we need to call it explicitely
-               $view->assign('settings', $this->settings); // same with settings injection.
-               return $view;
        }
 
        /**
@@ -441,7 +449,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
         * @return void
         */
        protected function clearCacheOnError() {
-               $extbaseSettings = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
+               $extbaseSettings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                if (isset($extbaseSettings['persistence']['enableAutomaticCacheClearing']) && $extbaseSettings['persistence']['enableAutomaticCacheClearing'] === '1') {
                        if (isset($GLOBALS['TSFE'])) {
                                $pageUid = $GLOBALS['TSFE']->id;
index 3c78aa9..7a4359d 100644 (file)
  * Interface for controllers
  *
  * @package Extbase
- * @subpackage MVC\Controller
  * @version $ID:$
  * @api
  */
 interface Tx_Extbase_MVC_Controller_ControllerInterface {
 
        /**
-        * Sets / injects the settings of the package this controller belongs to.
-        *
-        * Needed to emulate settings injection.
-        *
-        * @param array $settings Settings container of the current package
-        * @return void
-        */
-       public function setSettings(array $settings);
-
-       /**
         * Checks if the current request type is supported by the controller.
         *
-        * @param Tx_Extbase_MVC_Request $request The current request
+        * @param Tx_Extbase_MVC_RequestInterface $request The current request
         * @return boolean TRUE if this request type is supported, otherwise FALSE
         * @api
         */
-       public function canProcessRequest(Tx_Extbase_MVC_Request $request);
+       public function canProcessRequest(Tx_Extbase_MVC_RequestInterface $request);
 
        /**
         * Processes a general request. The result can be returned by altering the given response.
         *
         * @param Tx_Extbase_MVC_Request $request The request object
-        * @param Tx_Extbase_MVC_Response $response The response, modified by the controller
+        * @param Tx_Extbase_MVC_ResponseInterface $response The response, modified by the controller
         * @return void
         * @throws Tx_Extbase_MVC_Exception_UnsupportedRequestType if the controller doesn't support the current request type
         * @api
         */
-       public function processRequest(Tx_Extbase_MVC_Request $request, Tx_Extbase_MVC_Response $response);
+       public function processRequest(Tx_Extbase_MVC_RequestInterface $request, Tx_Extbase_MVC_ResponseInterface $response);
 
 }
 ?>
\ No newline at end of file
index f0299f5..c0cb599 100644 (file)
@@ -58,6 +58,19 @@ class Tx_Extbase_MVC_Controller_FlashMessages implements t3lib_Singleton {
        protected $flashMessageStorageKey = NULL;
 
        /**
+        * @var Tx_Extbase_Configuration_ConfigurationManager
+        */
+       protected $configurationManager;
+
+       /**
+        * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
+        * @return void
+        */
+       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
+       /**
         * Add another flash message.
         *
         * @param string $message
@@ -111,7 +124,7 @@ class Tx_Extbase_MVC_Controller_FlashMessages implements t3lib_Singleton {
        protected function initialize() {
                if ($this->initialized) return;
 
-               $frameworkConfiguration = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                $this->flashMessageStorageKey = 'Tx_Extbase_MVC_Controller_FlashMessages_messages_' . $frameworkConfiguration['extensionName'] . $frameworkConfiguration['pluginName'];
 
                $flashMessages = $this->loadFlashMessagesFromSession();
diff --git a/typo3/sysext/extbase/Classes/MVC/Dispatcher.php b/typo3/sysext/extbase/Classes/MVC/Dispatcher.php
new file mode 100644 (file)
index 0000000..ddd32ab
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 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!
+***************************************************************/
+
+/**
+ * Dispatches requests to the controller which was specified by the request and
+ * returns the response the controller generated.
+ *
+ */
+class Tx_Extbase_MVC_Dispatcher implements t3lib_Singleton {
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface A reference to the object manager
+        */
+       protected $objectManager;
+
+       /**
+        * @var Tx_Extbase_Reflection_Service
+        */
+       protected $reflectionService;
+
+       /**
+        * @var array
+        */
+       protected $settings = array();
+
+       /**
+        * Constructs the global dispatcher
+        *
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager A reference to the object manager
+        */
+       public function __construct(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * Injects the Reflection Service
+        *
+        * @param Tx_Extbase_Reflection_Service $reflectionService
+        * @return void
+        */
+       public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
+               $this->reflectionService = $reflectionService;
+       }
+
+       /**
+        * Dispatches a request to a controller and initializes the security framework.
+        *
+        * @param Tx_Extbase_MVC_RequestInterface $request The request to dispatch
+        * @param Tx_Extbase_MVC_ResponseInterface $response The response, to be modified by the controller
+        * @return void
+        */
+       public function dispatch(Tx_Extbase_MVC_RequestInterface $request, Tx_Extbase_MVC_ResponseInterface $response) {
+               $dispatchLoopCount = 0;
+               while (!$request->isDispatched()) {
+                       if ($dispatchLoopCount++ > 99) throw new Tx_Extbase_MVC_Exception_InfiniteLoop('Could not ultimately dispatch the request after '  . $dispatchLoopCount . ' iterations.', 1217839467);
+                       $controller = $this->resolveController($request);
+                       try {
+                               $controller->processRequest($request, $response);
+                       } catch (Tx_Extbase_MVC_Exception_StopAction $ignoredException) {
+                       }
+               }
+       }
+
+       /**
+        * Finds and instanciates a controller that matches the current request.
+        * If no controller can be found, an instance of NotFoundControllerInterface is returned.
+        *
+        * @param Tx_Extbase_MVC_RequestInterface $request The request to dispatch
+        * @return Tx_Extbase_MVC_Controller_ControllerInterface
+        * @author Bastian Waidelich <bastian@typo3.org>
+        * @author Robert Lemke <robert@typo3.org>
+        */
+       protected function resolveController(Tx_Extbase_MVC_RequestInterface $request) {
+               $controllerObjectName = $request->getControllerObjectName();
+               $controller = $this->objectManager->get($controllerObjectName);
+               if (!$controller instanceof Tx_Extbase_MVC_Controller_ControllerInterface) {
+                       throw new Tx_Extbase_MVC_Exception_InvalidController('Invalid controller "' . $request->getControllerObjectName() . '". The controller must implement the Tx_Extbase_MVC_Controller_ControllerInterface.', 1202921619);
+               }
+               return $controller;
+       }
+
+}
+?>
\ No newline at end of file
index dde8536..3487d91 100644 (file)
@@ -43,7 +43,7 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
         *
         * @var string
         */
-       protected $controllerObjectNamePattern = 'Tx_@extension_Controller_@controllerController';
+       protected $controllerObjectNamePattern = 'Tx_@extension_@subpackage_Controller_@controllerController';
 
        /**
         * @var string Key of the plugin which identifies the plugin. It must be a string containing [a-z0-9]
@@ -56,6 +56,13 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
        protected $controllerExtensionName = NULL;
 
        /**
+        * Subpackage key of the controller which is supposed to handle this request.
+        *
+        * @var string
+        */
+       protected $controllerSubpackageKey = NULL;
+
+       /**
         * @var string Object name of the controller which is supposed to handle this request.
         */
        protected $controllerName = 'Standard';
@@ -120,7 +127,9 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
         */
        public function getControllerObjectName() {
                $lowercaseObjectName = str_replace('@extension', $this->controllerExtensionName, $this->controllerObjectNamePattern);
+               $lowercaseObjectName = str_replace('@subpackage', $this->controllerSubpackageKey, $lowercaseObjectName);
                $lowercaseObjectName = str_replace('@controller', $this->controllerName, $lowercaseObjectName);
+               $lowercaseObjectName = str_replace('__', '_', $lowercaseObjectName);
                // TODO implement getCaseSensitiveObjectName()
                $objectName = $lowercaseObjectName;
                if ($objectName === FALSE) throw new Tx_Extbase_MVC_Exception_NoSuchController('The controller object "' . $lowercaseObjectName . '" does not exist.', 1220884009);
@@ -129,6 +138,32 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
        }
 
        /**
+        * Explicitly sets the object name of the controller
+        *
+        * @param string $controllerObjectName The fully qualified controller object name
+        * @return void
+        */
+       public function setControllerObjectName($controllerObjectName) {
+               $matches = array();
+               preg_match('/
+                       ^Tx
+                       _(?P<extensionName>[^_]+)
+                       _
+                       (
+                               Controller
+                       |
+                               (?P<subpackageKey>.+)_Controller
+                       )
+                       _(?P<controllerName>[a-z_]+)Controller
+                       $/ix', $controllerObjectName, $matches
+               );
+
+               $this->controllerExtensionName = $matches['extensionName'];
+               $this->controllerSubpackageKey = (isset($matches['subpackageKey'])) ? $matches['subpackageKey'] : NULL;
+               $this->controllerName = $matches['controllerName'];
+       }
+
+       /**
         * Sets the plugin name.
         *
         * @param string $extensionName The plugin name.
@@ -184,6 +219,26 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
        }
 
        /**
+        * Sets the subpackage key of the controller.
+        *
+        * @param string $subpackageKey The subpackage key.
+        * @return void
+        */
+       public function setControllerSubpackageKey($subpackageKey) {
+               $this->controllerSubpackageKey = $subpackageKey;
+       }
+
+       /**
+        * Returns the subpackage key of the specified controller.
+        * If there is no subpackage key set, the method returns NULL
+        *
+        * @return string The subpackage key
+        */
+       public function getControllerSubpackageKey() {
+               return $this->controllerSubpackageKey;
+       }
+
+       /**
         * Sets the name of the controller which is supposed to handle the request.
         * Note: This is not the object name of the controller!
         *
diff --git a/typo3/sysext/extbase/Classes/MVC/RequestHandlerInterface.php b/typo3/sysext/extbase/Classes/MVC/RequestHandlerInterface.php
new file mode 100644 (file)
index 0000000..c5d6360
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 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!
+ ***************************************************************/
+
+/**
+ * The interface for a request handler
+ *
+ * @api
+ */
+interface Tx_Extbase_MVC_RequestHandlerInterface {
+
+       /**
+        * Handles a raw request and sends the respsonse.
+        *
+        * @return void
+        * @api
+        */
+       public function handleRequest();
+
+       /**
+        * Checks if the request handler can handle the current request.
+        *
+        * @return boolean TRUE if it can handle the request, otherwise FALSE
+        * @api
+        */
+       public function canHandleRequest();
+
+       /**
+        * Returns the priority - how eager the handler is to actually handle the
+        * request. An integer > 0 means "I want to handle this request" where
+        * "100" is default. "0" means "I am a fallback solution".
+        *
+        * @return integer The priority of the request handler
+        * @api
+        */
+       public function getPriority();
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/MVC/RequestHandlerResolver.php b/typo3/sysext/extbase/Classes/MVC/RequestHandlerResolver.php
new file mode 100644 (file)
index 0000000..65cea4e
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 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!
+ ***************************************************************/
+
+/**
+ * Analyzes the raw request and delivers a request handler which can handle it.
+ */
+class Tx_Extbase_MVC_RequestHandlerResolver {
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * @var Tx_Extbase_Reflection_ReflectionService
+        */
+       protected $reflectionService;
+
+       /**
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
+        */
+       protected $configurationManager;
+
+       /**
+        * Injects the object manager
+        *
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager A reference to the object manager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * Injects the reflection service
+        *
+        * @param Tx_Extbase_Reflection_Service $reflectionService
+        * @return void
+        */
+       public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
+               $this->reflectionService = $reflectionService;
+       }
+
+       /**
+        * Injects the configuration manager
+        *
+        * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
+        * @return void
+        */
+       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
+       /**
+        * Analyzes the raw request and tries to find a request handler which can handle
+        * it. If none is found, an exception is thrown.
+        *
+        * @return Tx_Extbase_MVC_RequestHandler A request handler
+        * @throws Tx_Extbase_MVC_Exception
+        */
+       public function resolveRequestHandler() {
+               $availableRequestHandlerClassNames = $this->getRegisteredRequestHandlerClassNames();
+
+               $suitableRequestHandlers = array();
+               foreach ($availableRequestHandlerClassNames as $requestHandlerClassName) {
+                       $requestHandler = $this->objectManager->get($requestHandlerClassName);
+                       if ($requestHandler->canHandleRequest()) {
+                               $priority = $requestHandler->getPriority();
+                               if (isset($suitableRequestHandlers[$priority])) throw new Tx_Extbase_MVC_Exception('More than one request handler with the same priority can handle the request, but only one handler may be active at a time!', 1176475350);
+                               $suitableRequestHandlers[$priority] = $requestHandler;
+                       }
+               }
+               if (count($suitableRequestHandlers) === 0) throw new Tx_Extbase_MVC_Exception('No suitable request handler found.', 1205414233);
+               ksort($suitableRequestHandlers);
+               return array_pop($suitableRequestHandlers);
+       }
+
+       public function getRegisteredRequestHandlerClassNames() {
+               $settings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               return is_array($settings['mvc']['requestHandlers']) ? $settings['mvc']['requestHandlers'] : array();
+       }
+}
+?>
\ No newline at end of file
index 71f5f4b..4632283 100644 (file)
@@ -29,8 +29,6 @@
  * Contract for a request.
  *
  * @version $Id$
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
- * @author Robert Lemke <robert@typo3.org>
  * @scope prototype
  * @api
  */
index 04a10a1..a472580 100644 (file)
@@ -34,7 +34,7 @@
  * @scope prototype
  * @api
  */
-class Tx_Extbase_MVC_Response {
+class Tx_Extbase_MVC_Response implements Tx_Extbase_MVC_ResponseInterface {
 
        /**
         * @var string The response content
@@ -73,5 +73,15 @@ class Tx_Extbase_MVC_Response {
                return $this->content;
        }
 
+       /**
+        * Returns the content of the response.
+        *
+        * @return string
+        * @api
+        */
+       public function __toString() {
+               return $this->getContent();
+       }
+
 }
 ?>
\ No newline at end of file
index 4e887c6..4404429 100644 (file)
@@ -29,9 +29,6 @@
  * A generic and very basic response implementation
  *
  * @version $Id$
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
- * @author Robert Lemke <robert@typo3.org>
- * @scope prototype
  * @api
  */
 interface Tx_Extbase_MVC_ResponseInterface {
@@ -62,12 +59,5 @@ interface Tx_Extbase_MVC_ResponseInterface {
         */
        public function getContent();
 
-       /**
-        * Sends the response
-        *
-        * @return void
-        * @api
-        */
-       public function send();
 }
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/MVC/Web/AbstractRequestHandler.php b/typo3/sysext/extbase/Classes/MVC/Web/AbstractRequestHandler.php
new file mode 100644 (file)
index 0000000..6881162
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 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 request handler which can handle web requests.
+ *
+ */
+abstract class Tx_Extbase_MVC_Web_AbstractRequestHandler implements Tx_Extbase_MVC_RequestHandlerInterface {
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * Back reference to the parent content object
+        * This has to be public as it is set directly from TYPO3
+        *
+        * @var tslib_cObj
+        */
+       protected $cObj;
+
+       /**
+        * @var Tx_Extbase_MVC_Dispatcher
+        */
+       protected $dispatcher;
+
+       /**
+        * @var Tx_Extbase_MVC_Web_RequestBuilder
+        */
+       protected $requestBuilder;
+
+       /**
+        * @var Tx_Extbase_MVC_Controller_FlashMessages
+        */
+       protected $flashMessages;
+
+       /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectFlashMessages(Tx_Extbase_MVC_Controller_FlashMessages $flashMessages) {
+               $this->flashMessages = $flashMessages;
+       }
+
+       /**
+        * @param Tx_Extbase_MVC_Dispatcher $dispatcher
+        * @return void
+        */
+       public function injectDispatcher(Tx_Extbase_MVC_Dispatcher $dispatcher) {
+               $this->dispatcher = $dispatcher;
+       }
+
+       /**
+        * @param Tx_Extbase_MVC_Web_RequestBuilder $requestBuilder
+        * @return void
+        */
+       public function injectRequestBuilder(Tx_Extbase_MVC_Web_RequestBuilder $requestBuilder) {
+               $this->requestBuilder = $requestBuilder;
+       }
+
+       /**
+        * Sets the content object
+        *
+        * @param tslib_cObj $cObj
+        * @return void
+        */
+       public function setContentObject(tslib_cObj $cObj = NULL) {
+               $this->cObj = $cObj;
+       }
+
+       /**
+        * This request handler can handle any web request.
+        *
+        * @return boolean If the request is a web request, TRUE otherwise FALSE
+        */
+       public function canHandleRequest() {
+               return TRUE;
+       }
+
+       /**
+        * Returns the priority - how eager the handler is to actually handle the
+        * request.
+        *
+        * @return integer The priority of the request handler.
+        */
+       public function getPriority() {
+               return 100;
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/MVC/Web/BackendRequestHandler.php b/typo3/sysext/extbase/Classes/MVC/Web/BackendRequestHandler.php
new file mode 100644 (file)
index 0000000..06c06d6
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 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 request handler which can handle web requests invoked by the backend.
+ *
+ */
+class Tx_Extbase_MVC_Web_BackendRequestHandler extends Tx_Extbase_MVC_Web_AbstractRequestHandler {
+
+       /**
+        * Handles the web request. The response will automatically be sent to the client.
+        *
+        * @return void
+        */
+       public function handleRequest() {
+               $request = $this->requestBuilder->build();
+               $response = $this->objectManager->create('Tx_Extbase_MVC_Web_Response');
+
+               $this->dispatcher->dispatch($request, $response);
+
+               $this->flashMessages->persist();
+
+               return $response;
+       }
+
+       /**
+        * This request handler can handle a web request invoked by the backend.
+        *
+        * @return boolean If we are in backend mode TRUE otherwise FALSE
+        */
+       public function canHandleRequest() {
+               return TYPO3_MODE === 'BE';
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/MVC/Web/FrontendRequestHandler.php b/typo3/sysext/extbase/Classes/MVC/Web/FrontendRequestHandler.php
new file mode 100644 (file)
index 0000000..161f2dc
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 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 request handler which can handle web requests invoked by the frontend.
+ *
+ */
+class Tx_Extbase_MVC_Web_FrontendRequestHandler extends Tx_Extbase_MVC_Web_AbstractRequestHandler {
+
+       /**
+        * Handles the web request. The response will automatically be sent to the client.
+        *
+        * @return Tx_Extbase_MVC_Web_Response
+        */
+       public function handleRequest() {
+               $request = $this->requestBuilder->build();
+
+               // Request hash service
+               $requestHashService = $this->objectManager->get('Tx_Extbase_Security_Channel_RequestHashService'); // singleton
+               $requestHashService->verifyRequest($request);
+
+               if (isset($this->cObj->data) && is_array($this->cObj->data)) {
+                       // we need to check the above conditions as cObj is not available in Backend.
+                       $request->setContentObjectData($this->cObj->data);
+                       if ($this->isCacheable($request->getControllerName(), $request->getControllerActionName())) {
+                               $request->setIsCached(TRUE);
+                       } else {
+                               if ($this->cObj->getUserObjectType() === tslib_cObj::OBJECTTYPE_USER) {
+                                       $this->cObj->convertToUserIntObject();
+                                       // tslib_cObj::convertToUserIntObject() will recreate the object, so we have to stop the request here
+                                       return; //FIXME
+                               }
+                               $request->setIsCached(FALSE);
+                       }
+               }
+               $response = $this->objectManager->create('Tx_Extbase_MVC_Web_Response');
+
+               $this->dispatcher->dispatch($request, $response);
+
+               $this->flashMessages->persist();
+
+               return $response;
+       }
+
+       /**
+        * This request handler can handle any web request.
+        *
+        * @return boolean If the request is a web request, TRUE otherwise FALSE
+        */
+       public function canHandleRequest() {
+               return TYPO3_MODE === 'FE';
+       }
+
+       /**
+        * Determines whether the current action can be cached
+        *
+        * @param string $controllerName
+        * @param string $actionName
+        * @return boolean TRUE if the given action should be cached, otherwise FALSE
+        */
+       protected function isCacheable($controllerName, $actionName) {
+               if (isset($this->frameworkConfiguration['switchableControllerActions'][$controllerName]['nonCacheableActions'])
+                       && in_array($actionName, t3lib_div::trimExplode(',', $this->frameworkConfiguration['switchableControllerActions'][$controllerName]['nonCacheableActions']))) {
+                               return FALSE;
+                       }
+               return TRUE;
+       }
+
+}
+?>
\ No newline at end of file
index 07ddb31..ac5fa03 100644 (file)
@@ -34,7 +34,7 @@
  *
  * @scope prototype
  */
-class Tx_Extbase_MVC_Web_RequestBuilder {
+class Tx_Extbase_MVC_Web_RequestBuilder implements t3lib_Singleton {
        /**
         * @var Tx_Extbase_Object_ObjectManagerInterface
         */
@@ -75,7 +75,33 @@ class Tx_Extbase_MVC_Web_RequestBuilder {
         */
        protected $allowedControllerActions;
 
-       public function initialize($configuration) {
+       /**
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
+        */
+       protected $configurationManager;
+
+       /**
+        * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
+        */
+       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
+       /**
+        * Injects the object manager
+        *
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * @return void
+        */
+       protected function loadDefaultValues() {
+               $configuration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                if (!empty($configuration['pluginName'])) {
                        $this->pluginName = $configuration['pluginName'];
                }
@@ -105,16 +131,6 @@ class Tx_Extbase_MVC_Web_RequestBuilder {
                }
                $this->allowedControllerActions = $allowedControllerActions;
        }
-       
-       /**
-        * Injects the object manager
-        *
-        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
-        * @return void
-        */
-       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
-               $this->objectManager = $objectManager;
-       }
 
        /**
         * Builds a web request object from the raw HTTP information and the configuration
@@ -122,8 +138,8 @@ class Tx_Extbase_MVC_Web_RequestBuilder {
         * @return Tx_Extbase_MVC_Web_Request The web request as an object
         */
        public function build() {
-               $pluginSignature = strtolower($this->extensionName . '_' . $this->pluginName);
-               $pluginNamespace = Tx_Extbase_Utility_Extension::getPluginNamespaceByPluginSignature($pluginSignature);
+               $this->loadDefaultValues();
+               $pluginNamespace = Tx_Extbase_Utility_Extension::getPluginNamespace($this->extensionName, $this->pluginName);
                $parameters = t3lib_div::_GPmerged($pluginNamespace);
 
                if (is_string($parameters['controller']) && array_key_exists($parameters['controller'], $this->allowedControllerActions)) {
index 3e31ee5..3efe598 100644 (file)
@@ -96,9 +96,15 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder {
        protected $format = '';
 
        /**
+        * @var string
+        */
+       protected $argumentPrefix = NULL;
+
+       /**
         * Constructs this URI Helper
         */
        public function __construct() {
+               // TODO shouldn't we retrieve the current cObject from the request?
                $this->contentObject = t3lib_div::makeInstance('tslib_cObj');
        }
 
@@ -247,6 +253,24 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder {
        }
 
        /**
+        * Specifies the prefix to be used for all arguments.
+        *
+        * @param string $argumentPrefix
+        * @return Tx_Extbase_MVC_Web_Routing_UriBuilder the current UriBuilder to allow method chaining
+        */
+       public function setArgumentPrefix($argumentPrefix) {
+               $this->argumentPrefix = (string)$argumentPrefix;
+               return $this;
+       }
+
+       /**
+        * @return string
+        */
+       public function getArgumentPrefix() {
+               return $this->argumentPrefix;
+       }
+
+       /**
         * If set, URIs for pages without access permissions will be created
         *
         * @param boolean $linkAccessRestrictedPages
@@ -379,6 +403,7 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder {
                $this->targetPageType = 0;
                $this->noCache = FALSE;
                $this->useCacheHash = TRUE;
+               $this->argumentPrefix = NULL;
 
                return $this;
        }
@@ -414,15 +439,18 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder {
                if ($pluginName === NULL) {
                        $pluginName = $this->request->getPluginName();
                }
-               $pluginSignature = strtolower($extensionName . '_' . $pluginName);
                if ($this->targetPageUid === NULL && TYPO3_MODE === 'FE') {
-                       $this->targetPageUid = Tx_Extbase_Utility_Extension::getTargetPidByPluginSignature($pluginSignature);
+                       $this->targetPageUid = Tx_Extbase_Utility_Extension::getTargetPidByPlugin($extensionName, $pluginName);
                }
                if ($this->format !== '') {
                        $controllerArguments['format'] = $this->format;
                }
-               $pluginNamespace = Tx_Extbase_Utility_Extension::getPluginNamespaceByPluginSignature($pluginSignature);
-               $prefixedControllerArguments = array($pluginNamespace => $controllerArguments);
+               $pluginNamespace = Tx_Extbase_Utility_Extension::getPluginNamespace($extensionName, $pluginName);
+               if ($this->argumentPrefix !== NULL) {
+                       $prefixedControllerArguments = array($this->argumentPrefix => $controllerArguments);
+               } else {
+                       $prefixedControllerArguments = array($pluginNamespace => $controllerArguments);
+               }
                $this->arguments = t3lib_div::array_merge_recursive_overrule($this->arguments, $prefixedControllerArguments);
 
                return $this->build();
diff --git a/typo3/sysext/extbase/Classes/Object/Container/ClassInfo.php b/typo3/sysext/extbase/Classes/Object/Container/ClassInfo.php
new file mode 100644 (file)
index 0000000..15ff738
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Extbase Team
+*  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!
+***************************************************************/
+/**
+ * Value object containing the relevant informations for a class,
+ * this object is build by the classInfoFactory - or could also be restored from a cache
+ * 
+ * @author Daniel Pötzinger
+ */
+class Tx_Extbase_Object_Container_ClassInfo {
+
+       /**
+        * The classname of the class where the infos belong to
+        * @var string
+        */
+       private $className;
+
+       /**
+        * The constructor Dependencies for the class in the format:
+        *       array(
+        *     0 => array( <-- parameters for argument 1
+        *       'name' => <arg name>, <-- name of argument
+        *       'dependency' => <classname>, <-- if the argument is a class, the type of the argument
+        *       'defaultvalue' => <mixed>) <-- if the argument is optional, its default value
+        *     ),
+        *     1 => ...
+        *   )
+        * 
+        * @var array
+        */
+       private $constructorArguments;
+       
+       /**
+        * All setter injections in the format
+        *      array (<nameOfMethod> => <classNameToInject> )
+        * 
+        * @var array
+        */
+       private $injectMethods;
+
+       /**
+        * 
+        * @param string $className
+        * @param array $constructorArguments
+        * @param array $injectMethods
+        */
+       public function __construct($className, array $constructorArguments, array $injectMethods) {
+               $this->className = $className;
+               $this->constructorArguments = $constructorArguments;
+               $this->injectMethods = $injectMethods;
+       }
+       
+       /**
+        * @return the $className
+        */
+       public function getClassName() {
+               return $this->className;
+       }
+
+       /**
+        * @return the $constructorArguments
+        */
+       public function getConstructorArguments() {
+               return $this->constructorArguments;
+       }
+
+       /**
+        * @return the $injectMethods
+        */
+       public function getInjectMethods() {
+               return $this->injectMethods;
+       }
+       
+       /**
+        * @return the $injectMethods
+        */
+       public function hasInjectMethods() {
+               return (count($this->injectMethods) > 0);
+       }
+}
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/Container/ClassInfoCache.php b/typo3/sysext/extbase/Classes/Object/Container/ClassInfoCache.php
new file mode 100644 (file)
index 0000000..6ed7cf3
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Extbase Team
+*  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!
+***************************************************************/
+
+/**
+ * Simple Cache for classInfos
+ * 
+ * @author Daniel Pötzinger
+ */
+class Tx_Extbase_Object_Container_ClassInfoCache {
+       
+       /**
+        * 
+        * @var array
+        */
+       private $level1Cache=array();
+       
+       /**
+        * 
+        * @var t3lib_cache_frontend_VariableFrontend
+        */
+       private $level2Cache;
+       
+       /**
+        * constructor
+        */
+       public function __construct() {
+               $this->initializeLevel2Cache();
+       }
+       
+       /**
+        * checks if cacheentry exists for id
+        * @param string $id
+        */
+       public function has($id) {
+               return isset($this->level1Cache[$id]) || $this->level2Cache->has($id);
+       }
+       
+       /**
+        * Gets the cache for the id
+        * @param string $id
+        */
+       public function get($id) {
+               if (!isset($this->level1Cache[$id])) {
+                       $this->level1Cache[$id] = $this->level2Cache->get($id);
+               }
+               return $this->level1Cache[$id];
+       }
+       
+       /**
+        * sets the cache for the id
+        * 
+        * @param $id
+        * @param $value
+        */
+       public function set($id,$value) {
+               $this->level1Cache[$id]=$value;
+               $this->level2Cache->set($id,$value);
+       }
+       
+       
+       /**
+        * Initialize the TYPO3 second level cache
+        */
+       private function initializeLevel2Cache() {
+               t3lib_cache::initializeCachingFramework();
+               $backend = 't3lib_cache_backend_FileBackend';
+               $frontend = 't3lib_cache_frontend_VariableFrontend';
+               $config = array('defaultLifetime' => 3600);
+               if ($GLOBALS['typo3CacheManager']->hasCache('Tx_Extbase_Object_Container_ClassInfoCache')) {
+                       $this->level2Cache = $GLOBALS['typo3CacheManager']->getCache('Tx_Extbase_Object_Container_ClassInfoCache') ;
+               } else {
+                       try {
+                               $this->level2Cache = $GLOBALS['typo3CacheFactory']->create('Tx_Extbase_Object_Container_ClassInfoCache', $frontend, $backend, $config);
+                       } catch (Exception $e) {
+                               throw new Tx_Extbase_Object_Container_Exception_CannotInitializeCacheException('cache init [Tx_Extbase_Object_Container_ClassInfoCache/' . $frontend . '/' . $backend . '] failed:' . get_class($e) . ' - ' . $e->getMessage(), 1289386629);
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/Container/ClassInfoFactory.php b/typo3/sysext/extbase/Classes/Object/Container/ClassInfoFactory.php
new file mode 100644 (file)
index 0000000..3985f54
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Extbase Team
+*  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!
+***************************************************************/
+
+/**
+ * TYPO3 Dependency Injection container
+ *
+ * @author Daniel Pötzinger
+ */
+class Tx_Extbase_Object_Container_ClassInfoFactory {
+
+       /**
+        * Factory metod that builds a ClassInfo Object for the given classname - using reflection
+        *
+        * @param string $className The class name to build the class info for
+        * @return Tx_Extbase_Object_Container_ClassInfo the class info
+        */
+       public function buildClassInfoFromClassName($className) {
+               try {
+                       $reflectedClass = new ReflectionClass($className);
+               } catch (Exception $e) {
+                       throw new Tx_Extbase_Object_Container_Exception_UnknownObjectException('Could not analyse class:' . $className . ' maybe not loaded or no autoloader?', 1289386765);
+               }
+               $constructorArguments = $this->getConstructorArguments($reflectedClass);
+               $injectMethods = $this->getInjectMethods($reflectedClass);
+               return new Tx_Extbase_Object_Container_ClassInfo($className, $constructorArguments, $injectMethods);
+       }
+
+       /**
+        * Build a list of constructor arguments
+        *
+        * @param ReflectionClass $reflectedClass
+        * @return array of parameter infos for constructor
+        */
+       private function getConstructorArguments(ReflectionClass $reflectedClass) {
+               $reflectionMethod = $reflectedClass->getConstructor();
+               if (!is_object($reflectionMethod)) {
+                       return array();
+               }
+               $result = array();
+               foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
+                       /* @var $reflectionParameter ReflectionParameter */
+                       $info = array();
+
+                       $info['name'] = $reflectionParameter->getName();
+
+                       if ($reflectionParameter->getClass()) {
+                               $info['dependency'] = $reflectionParameter->getClass()->getName();
+                       }
+                       if ($reflectionParameter->isOptional()) {
+                               $info['defaultValue'] = $reflectionParameter->getDefaultValue();
+                       }
+
+                       $result[] = $info;
+               }
+               return $result;
+       }
+
+       /**
+        * Build a list of inject methods
+
+        * @param ReflectionClass $reflectedClass
+        * @retrn array of inject methods
+        */
+       private function getInjectMethods(ReflectionClass $reflectedClass) {
+               $result = array();
+               $reflectionMethods = $reflectedClass->getMethods();
+
+               if (is_array($reflectionMethods)) {
+                       foreach ($reflectionMethods as $reflectionMethod) {
+                               if ($reflectionMethod->isPublic() && substr($reflectionMethod->getName(), 0, 6) === 'inject') {
+                                       $reflectionParameter = $reflectionMethod->getParameters();
+                                       if (isset($reflectionParameter[0])) {
+                                               if (!$reflectionParameter[0]->getClass()) {
+                                                       throw new Exception('Method is marked as setter for Dependency Injection, but doesnt have a type annotation');
+                                               }
+                                               $result[$reflectionMethod->getName()] = $reflectionParameter[0]->getClass()->getName();
+                                       }
+                               }
+                       }
+               }
+               return $result;
+       }
+}
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/Container/Container.php b/typo3/sysext/extbase/Classes/Object/Container/Container.php
new file mode 100644 (file)
index 0000000..5de5cfe
--- /dev/null
@@ -0,0 +1,269 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Extbase Team
+*  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!
+***************************************************************/
+
+/**
+ * TYPO3 Dependency Injection container
+ * Initial Usage:
+ *  $container = Tx_Extbase_Object_Container_Container::getContainer()
+ *
+ * @author Daniel Pötzinger
+ */
+class Tx_Extbase_Object_Container_Container {
+
+       /**
+        * PHP singleton impelementation
+        *
+        * @var Tx_Extbase_Object_Container_Container
+        */
+       static private $containerInstance = null;
+
+       /**
+        * internal cache for classinfos
+        *
+        * @var Tx_Extbase_Object_Container_ClassInfoCache
+        */
+       private $cache;
+
+       /**
+        * registered alternative implementations of a class
+        * e.g. used to know the class for a AbstractClass or a Dependency
+        *
+        * @var array
+        */
+       private $alternativeImplementation;
+
+       /**
+        * reference to the classinfofactory, that analyses dependencys
+        * @var classInfoFactory
+        */
+       private $classInfoFactory;
+
+       /**
+        * holds references of singletons
+        * @var array
+        */
+       private $singletonInstances = array();
+
+       /**
+        * holds references of objects that still needs setter injection processing
+        * @var array
+        */
+       private $setterInjectionRegistry = array();
+
+       /**
+        * Constructor is protected since container should
+        * be a singleton.
+        *
+        * @see getContainer()
+        * @param void
+        * @return void
+        */
+       protected function __construct() {
+               $this->classInfoFactory = new Tx_Extbase_Object_Container_ClassInfoFactory();
+               $this->cache = new Tx_Extbase_Object_Container_ClassInfoCache();
+       }
+
+       /**
+        * Returns an instance of the container singleton.
+        *
+        * @return Tx_Extbase_Object_Container_Container
+        */
+       static public function getContainer() {
+               if (self::$containerInstance === NULL) {
+                       self::$containerInstance = new Tx_Extbase_Object_Container_Container();
+               }
+               return self::$containerInstance;
+       }
+
+       private function __clone() {}
+
+       /**
+        * gets an instance of the given class
+        * @param string $className
+        * @return object
+        */
+       public function getInstance($className) {
+               $givenConstructorArguments=array();
+               if (func_num_args() > 1) {
+                               $givenConstructorArguments = func_get_args();
+                               array_shift($givenConstructorArguments);
+               }
+               $object = $this->getInstanceFromClassName($className, $givenConstructorArguments, 0);
+               $this->processSetterInjectionRegistry();
+               return $object;
+       }
+
+       /**
+        * register a classname that should be used if a dependency is required.
+        * e.g. used to define default class for a interface
+        *
+        * @param string $className
+        * @param string $alternativeClassName
+        */
+       public function registerImplementation($className,$alternativeClassName) {
+               $this->alternativeImplementation[$className] = $alternativeClassName;
+       }
+
+       /**
+        * gets an instance of the given class
+        * @param string $className
+        * @param array $givenConstructorArguments
+        */
+       private function getInstanceFromClassName($className, array $givenConstructorArguments=array(), $level=0) {
+               if ($level > 30) {
+                       throw new Tx_Extbase_Object_Container_Exception_TooManyRecursionLevelsException('Too many recursion levels. This should never happen, please file a bug!' . $className, 1289386945);
+               }
+               if ($className === 'Tx_Extbase_Object_Container_Container') {
+                       return $this;
+               }
+               if (isset($this->singletonInstances[$className])) {
+                       return $this->singletonInstances[$className];
+               }
+
+               $className = $this->getClassName($className);
+
+               $classInfo = $this->getClassInfo($className);
+
+               $constructorArguments = $this->getConstructorArguments($classInfo->getConstructorArguments(), $givenConstructorArguments, $level);
+               $instance = $this->newObject($className, $constructorArguments);
+
+               if ($level > 0 && !($instance instanceof t3lib_Singleton)) {
+                       throw new Tx_Extbase_Object_Exception_WrongScope('Object "' . $className . '" is of not of scope singleton, but only singleton instances can be injected into other classes.', 1289387047);
+               }
+
+               if ($classInfo->hasInjectMethods()) {
+                       $this->setterInjectionRegistry[]=array($instance, $classInfo->getInjectMethods(), $level);
+               }
+
+               if ($instance instanceof t3lib_Singleton) {
+                       $this->singletonInstances[$className] = $instance;
+               }
+               return $instance;
+       }
+
+       /**
+        * returns a object of the given type, called with the constructor arguments.
+        * For speed improvements reflection is avoided
+        *
+        * @param string $className
+        * @param array $constructorArguments
+        */
+       private function newObject($className, array $constructorArguments) {
+               array_unshift($constructorArguments, $className);
+               return call_user_func_array(array('t3lib_div', 'makeInstance'), $constructorArguments);
+       }
+
+       /**
+        * gets array of parameter that can be used to call a constructor
+        *
+        * @param array $constructorArgumentInformation
+        * @param array $givenConstructorArguments
+        * @return array
+        */
+       private function getConstructorArguments(array $constructorArgumentInformation, array $givenConstructorArguments, $level) {
+               $parameters=array();
+               foreach ($constructorArgumentInformation as $argumentInformation) {
+                       $argumentName = $argumentInformation['name'];
+
+                       if (count($givenConstructorArguments)) {
+                               // we have a value to set
+                               $parameter = array_shift($givenConstructorArguments);
+                       } elseif (isset($argumentInformation['dependency'])) {
+                               // Inject parameter
+                               $parameter = $this->getInstanceFromClassName($argumentInformation['dependency'], array(), $level+1);
+                       } elseif (isset($argumentInformation['defaultValue'])) {
+                               // no value to set anymore, we take default value
+                               $parameter = $argumentInformation['defaultValue'];
+                       } else {
+                               throw new InvalidArgumentException('not a correct info array of constructor dependencies was passed!');
+                       }
+                       $parameters[] = $parameter;
+               }
+               return $parameters;
+       }
+
+       /**
+        * Returns the class name for a new instance, taking into account the
+        * class-extension API.
+        *
+        * @param       string          Base class name to evaluate
+        * @return      string          Final class name to instantiate with "new [classname]"
+        */
+       protected function getClassName($className) {
+               if (isset($this->alternativeImplementation[$className])) {
+                       $className = $this->alternativeImplementation[$className];
+               }
+
+               if (substr($className, -9) === 'Interface') {
+                       $className = substr($className, 0, -9);
+               }
+
+               return $className;
+       }
+
+       /**
+        * do inject dependecies to object $instance using the given methods
+        *
+        * @param object $instance
+        * @param array $setterMethods
+        * @param integer $level
+        */
+       private function handleSetterInjection($instance, array $setterMethods, $level) {
+               foreach ($setterMethods as $method => $dependency) {
+                       $instance->$method($this->getInstanceFromClassName($dependency, array(), $level+1));
+               }
+       }
+
+       /**
+        * Gets Classinfos for the className - using the cache and the factory
+        *
+        * @param string $className
+        * @return Tx_Extbase_Object_Container_ClassInfo
+        */
+       private function getClassInfo($className) {
+               if (!$this->cache->has($className)) {
+                       $this->cache->set($className, $this->classInfoFactory->buildClassInfoFromClassName($className));
+               }
+               return $this->cache->get($className);
+       }
+
+       /**
+        * does setter injection based on the data in $this->setterInjectionRegistry
+        * Its done as long till no setters are left
+        *
+        * @return void
+        */
+       private function processSetterInjectionRegistry() {
+               while (count($this->setterInjectionRegistry)>0) {
+                       $currentSetterData = $this->setterInjectionRegistry;
+                       $this->setterInjectionRegistry = array();
+                       foreach ($currentSetterData as $setterInjectionData) {
+                               $this->handleSetterInjection($setterInjectionData[0], $setterInjectionData[1], $setterInjectionData[2]);
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/Container/Exception/CannotInitializeCacheException.php b/typo3/sysext/extbase/Classes/Object/Container/Exception/CannotInitializeCacheException.php
new file mode 100644 (file)
index 0000000..c81f174
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Extbase Team
+*  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!
+***************************************************************/
+
+/**
+ * Exception thrown if cache cannot be built.
+ */
+class Tx_Extbase_Object_Container_Exception_CannotInitializeCacheException extends Tx_Extbase_Object_Exception {
+}
+?>
diff --git a/typo3/sysext/extbase/Classes/Object/Container/Exception/TooManyRecursionLevelsException.php b/typo3/sysext/extbase/Classes/Object/Container/Exception/TooManyRecursionLevelsException.php
new file mode 100644 (file)
index 0000000..9cee780
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Extbase Team
+*  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!
+***************************************************************/
+
+/**
+ * Exception thrown if cache cannot be built.
+ */
+class Tx_Extbase_Object_Container_Exception_TooManyRecursionLevelsException extends Tx_Extbase_Object_Exception {
+}
+?>
diff --git a/typo3/sysext/extbase/Classes/Object/Container/Exception/UnknownObjectException.php b/typo3/sysext/extbase/Classes/Object/Container/Exception/UnknownObjectException.php
new file mode 100644 (file)
index 0000000..8a55729
--- /dev/null
@@ -0,0 +1,39 @@
+<?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!
+***************************************************************/
+
+/**
+ * "Unknown Object" Exception
+ *
+ * @package Extbase
+ * @subpackage Object\Exception
+ * @version $Id: UnknownObjectException.php 2703 2010-11-10 11:28:01Z sebastian $
+ */
+class Tx_Extbase_Object_Container_Exception_UnknownObjectException extends Tx_Extbase_Object_Exception {
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Object/Exception/UnknownObject.php b/typo3/sysext/extbase/Classes/Object/Exception/UnknownObject.php
deleted file mode 100644 (file)
index 75c222f..0000000
+++ /dev/null
@@ -1,39 +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!
-***************************************************************/
-
-/**
- * "Unknown Object" Exception
- *
- * @package Extbase
- * @subpackage Object\Exception
- * @version $Id$
- */
-class Tx_Extbase_Object_UnknownObject extends Tx_Extbase_Object_Exception {
-
-}
-
-?>
\ No newline at end of file
index 5e7fdd2..c5f8254 100644 (file)
@@ -34,7 +34,7 @@
 class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManagerInterface {
 
        /**
-        * @var Tx_Container_Container
+        * @var Tx_Extbase_Object_Container_Container
         */
        protected $objectContainer;
 
@@ -42,7 +42,7 @@ class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManager
         * Constructs a new Object Manager
         */
        public function __construct() {
-               $this->objectContainer = Tx_Container_Container::getContainer();
+               $this->objectContainer = Tx_Extbase_Object_Container_Container::getContainer();
        }
 
        /**
@@ -95,7 +95,7 @@ class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManager
         * @param string $alternativeClassName
         */
        static public function registerImplementation($className, $alternativeClassName) {
-               return Tx_Container_Container::getContainer()->registerImplementation($className, $alternativeClassName);
+               return Tx_Extbase_Object_Container_Container::getContainer()->registerImplementation($className, $alternativeClassName);
        }
 }
 
index 9fc69cd..34222e3 100644 (file)
@@ -88,18 +88,19 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
        protected $referenceIndex;
 
        /**
-        * @var array
-        **/
-       protected $extbaseSettings;
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
+        */
+       protected $configurationManager;
 
        /**
         * Constructs the backend
         *
         * @return void
         */
-       public function __construct() {
-               $this->extbaseSettings = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
-               if ($this->extbaseSettings['persistence']['updateReferenceIndex'] === '1') {
+       public function __construct(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
+               $this->configurationManager = $configurationManager;
+               $frameworkConfiguration = $configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
                        $this->referenceIndex = t3lib_div::makeInstance('t3lib_refindex');
                }
        }
@@ -675,7 +676,8 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                        $row
                        );
                $object->_setProperty('uid', (int)$uid);
-               if ($this->extbaseSettings['persistence']['updateReferenceIndex'] === '1') {
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
                        $this->referenceIndex->updateRefIndexTable($dataMap->getTableName(), $uid);
                }
                $this->identityMap->registerObject($object, $uid);
@@ -793,7 +795,8 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                        $dataMap->getTableName(),
                        $row
                        );
-               if ($this->extbaseSettings['persistence']['updateReferenceIndex'] === '1') {
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
                        $this->referenceIndex->updateRefIndexTable($dataMap->getTableName(), $row['uid']);
                }
                return $res;
@@ -864,7 +867,8 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                                );
                }
                $this->removeRelatedObjects($object);
-               if ($this->extbaseSettings['persistence']['updateReferenceIndex'] === '1') {
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
                        $this->referenceIndex->updateRefIndexTable($tableName, $object->getUid());
                }
        }
@@ -907,14 +911,14 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
         * @return int the storage Page ID where the object should be stored
         */
        protected function determineStoragePageIdForNewRecord(Tx_Extbase_DomainObject_DomainObjectInterface $object = NULL) {
-               $extbaseSettings = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                if ($object !== NULL) {
                        $className = get_class($object);
-                       if (isset($extbaseSettings['persistence']['classes'][$className]) && !empty($extbaseSettings['persistence']['classes'][$className]['newRecordStoragePid'])) {
-                               return (int)$extbaseSettings['persistence']['classes'][$className]['newRecordStoragePid'];
+                       if (isset($frameworkConfiguration['persistence']['classes'][$className]) && !empty($frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'])) {
+                               return (int)$frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'];
                        }
                }
-               $storagePidList = t3lib_div::intExplode(',', $extbaseSettings['persistence']['storagePid']);
+               $storagePidList = t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid']);
                return (int) $storagePidList[0];
        }
 
index 9736849..c195a5a 100644 (file)
  * @version $ID:$
  */
 class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
-       
+
        /**
         * @var Tx_Extbase_Reflection_Service
         */
        protected $reflectionService;
 
        /**
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
+        */
+       protected $configurationManager;
+
+       /**
         * Injects the reflection service
         *
         * @param Tx_Extbase_Reflection_Service $reflectionService
@@ -45,7 +50,15 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
        public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
-       
+
+       /**
+        * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
+        * @return void
+        */
+       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
        /**
         * Builds a data map by adding column maps for all the configured columns in the $TCA.
         * It also resolves the type of values the column is holding and the typo of relation the column
@@ -63,9 +76,9 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                $subclasses = array();
                $tableName = strtolower($className);
                $columnMapping = array();
-               
-               $extbaseFrameworkConfiguration = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
-               $classSettings = $extbaseFrameworkConfiguration['persistence']['classes'][$className];
+
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               $classSettings = $frameworkConfiguration['persistence']['classes'][$className];
                if ($classSettings !== NULL) {
                        if (isset($classSettings['subclasses']) && is_array($classSettings['subclasses'])) {
                                $subclasses = $classSettings['subclasses'];
@@ -81,8 +94,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                                if (in_array($currentClassName, array('Tx_Extbase_DomainObject_AbstractEntity', 'Tx_Extbase_DomainObject_AbstractValueObject'))) {
                                        break;
                                }
-                               $currentTableName = strtolower($currentClassName);
-                               $currentClassSettings = $extbaseFrameworkConfiguration['persistence']['classes'][$currentClassName];
+                               $currentClassSettings = $frameworkConfiguration['persistence']['classes'][$currentClassName];
                                if ($currentClassSettings !== NULL) {
                                        if (isset($currentClassSettings['mapping']['columns']) && is_array($currentClassSettings['mapping']['columns'])) {
                                                $columnMapping = t3lib_div::array_merge_recursive_overrule($columnMapping, $currentClassSettings['mapping']['columns'], 0, FALSE); // FALSE means: do not include empty values form 2nd array
@@ -113,7 +125,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                // debug($dataMap);
                return $dataMap;
        }
-               
+
        /**
         * Returns the TCA ctrl section of the specified table; or NULL if not set
         *
@@ -124,7 +136,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                $this->includeTca($tableName);
                return is_array($GLOBALS['TCA'][$tableName]['ctrl']) ? $GLOBALS['TCA'][$tableName]['ctrl'] : NULL;
        }
-       
+
        /**
         * Returns the TCA columns array of the specified table
         *
@@ -135,7 +147,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                $this->includeTca($tableName);
                return is_array($GLOBALS['TCA'][$tableName]['columns']) ? $GLOBALS['TCA'][$tableName]['columns'] : array();
        }
-       
+
        /**
         * Includes the TCA for the given table
         *
@@ -148,7 +160,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                }
                t3lib_div::loadTCA($tableName);
        }
-       
+
        protected function addMetaDataColumnNames(Tx_Extbase_Persistence_Mapper_DataMap $dataMap, $tableName) {
                $controlSection = $GLOBALS['TCA'][$tableName]['ctrl'];
                $dataMap->setPageIdColumnName('pid');
@@ -165,7 +177,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                if (isset($controlSection['enablecolumns']['fe_group'])) $dataMap->setFrontEndUserGroupColumnName($controlSection['enablecolumns']['fe_group']);
                return $dataMap;
        }
-               
+
        /**
         * This method tries to determine the type of type of relation to other tables and sets it based on
         * the $TCA column configuration
@@ -191,7 +203,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                }
                return $columnMap;
        }
-       
+
        /**
         * This method sets the configuration for a 1:1 relation based on
         * the $TCA column configuration
@@ -209,7 +221,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                $columnMap->setParentTableFieldName($columnConfiguration['foreign_table_field']);
                return $columnMap;
        }
-       
+
        /**
         * This method sets the configuration for a 1:n relation based on
         * the $TCA column configuration
@@ -227,7 +239,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                $columnMap->setParentTableFieldName($columnConfiguration['foreign_table_field']);
                return $columnMap;
        }
-       
+
        /**
         * This method sets the configuration for a m:n relation based on
         * the $TCA column configuration
@@ -274,5 +286,5 @@ class Tx_Extbase_Persistence_Mapper_DataMapFactory implements t3lib_Singleton {
                }
                return $columnMap;
        }
-               
+
 }
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactoryInterface.php b/typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactoryInterface.php
new file mode 100644 (file)
index 0000000..9c64be0
--- /dev/null
@@ -0,0 +1,42 @@
+<?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: QueryObjectModelFactoryInterface.php 1971 2010-03-08 16:59:04Z jocrau $
+ */
+interface Tx_Extbase_Persistence_QOM_QueryObjectModelFactoryInterface extends Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface {
+
+
+}
+
+?>
\ No newline at end of file
index c75818d..e43fd77 100644 (file)
@@ -591,5 +591,22 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
                        );
        }
 
+       /**
+        * @return void
+        */
+       public function __wakeup() {
+               $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
+               $this->persistenceManager = $this->objectManager->get('Tx_Extbase_Persistence_ManagerInterface');
+               $this->dataMapper = $this->objectManager->get('Tx_Extbase_Persistence_Mapper_DataMapper');
+               $this->qomFactory = $this->objectManager->get('Tx_Extbase_Persistence_QOM_QueryObjectModelFactory');
+       }
+
+       /**
+        * @return array
+        */
+       public function __sleep() {
+               return array('type', 'source', 'constraint', 'statement', 'orderings', 'limit', 'offset', 'querySettings');
+       }
+
 }
 ?>
\ No newline at end of file
index b1e09e3..06c4489 100644 (file)
@@ -242,5 +242,21 @@ class Tx_Extbase_Persistence_QueryResult implements Tx_Extbase_Persistence_Query
                $this->initialize();
                return current($this->queryResult) !== FALSE;
        }
+
+       /**
+        * @return void
+        */
+       public function __wakeup() {
+               $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
+               $this->persistenceManager = $objectManager->get('Tx_Extbase_Persistence_ManagerInterface');
+               $this->dataMapper = $objectManager->get('Tx_Extbase_Persistence_Mapper_DataMapper');
+       }
+
+       /**
+        * @return array
+        */
+       public function __sleep() {
+               return array('query');
+       }
 }
 ?>
\ No newline at end of file
index fddab2c..b7b66dd 100644 (file)
@@ -239,7 +239,7 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
                $result = $this->createQuery()->execute();
                return $result;
        }
-       
+
        /**
         * Returns the total number objects of this repository.
         *
@@ -249,7 +249,7 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
        public function countAll() {
                return $this->createQuery()->count();
        }
-       
+
        /**
         * Removes all objects of this repository as if remove() was called for
         * all of them.
index b0dd05b..9f8da24 100644 (file)
@@ -36,7 +36,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
 
        const OPERATOR_EQUAL_TO_NULL = 'operatorEqualToNull';
        const OPERATOR_NOT_EQUAL_TO_NULL = 'operatorNotEqualToNull';
-       
+
        /**
         * The TYPO3 database object
         *
@@ -71,6 +71,11 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
        protected $tableInformationCache = array();
 
        /**
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
+        */
+       protected $configurationManager;
+
+       /**
         * Constructor. takes the database handle from $GLOBALS['TYPO3_DB']
         */
        public function __construct() {
@@ -78,6 +83,14 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
        }
 
        /**
+        * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager
+        * @return void
+        */
+       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
+       /**
         * Injects the DataMapper to map nodes to objects
         *
         * @param Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper
@@ -191,7 +204,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        return FALSE;
                }
        }
-       
+
        protected function parseIdentifier(array $identifier) {
                $fieldNames = array_keys($identifier);
                $suffixedFieldNames = array();
@@ -200,7 +213,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                }
                return implode(' AND ', $suffixedFieldNames);
        }
-       
+
        /**
         * Returns the object data matching the $query.
         *
@@ -217,7 +230,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        $parameters = $statement->getBoundVariables();
                } else {
                        $parameters = array();
-                       $statementParts = $this->parseQuery($query, $parameters);                       
+                       $statementParts = $this->parseQuery($query, $parameters);
                        $sql = $this->buildQuery($statementParts, $parameters);
                }
                $this->replacePlaceholders($sql, $parameters);
@@ -250,7 +263,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $rows = $this->getRowsFromResult($query->getSource(), $result);
                return current(current($rows));
        }
-               
+
        /**
         * Parses the query and returns the SQL statement parts.
         *
@@ -269,7 +282,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $sql['limit'] = array();
 
                $source = $query->getSource();
-               
+
                $this->parseSource($source, $sql, $parameters);
                $this->parseConstraint($query->getConstraint(), $source, $sql, $parameters);
                $this->parseOrderings($query->getOrderings(), $source, $sql);
@@ -284,7 +297,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
 
                return $sql;
        }
-       
+
        /**
         * Returns the statement, ready to be executed.
         *
@@ -337,7 +350,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
 
                $tableName = $dataMap->getTableName();
                $this->addEnableFieldsStatement($tableName, $sql);
-               
+
                $statement = 'SELECT * FROM ' . $tableName;
                $statement .= ' WHERE ' . implode(' AND ', $fields);
                if (!empty($sql['additionalWhereClause'])) {
@@ -374,7 +387,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        $this->parseJoin($source, $sql);
                }
        }
-       
+
        /**
         * Adda a constrint to ensure that the record type of the returned tuples is matching the data type of the repository.
         *
@@ -430,7 +443,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        $sql['fields'][$leftTableName] = $rightTableName . '.*';
                }
                $this->addRecordTypeConstraint($rightClassName, $sql);
-               
+
                $sql['tables'][$leftTableName] = $leftTableName;
                $sql['unions'][$rightTableName] = 'LEFT JOIN ' . $rightTableName;
 
@@ -459,13 +472,13 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                if ($constraint instanceof Tx_Extbase_Persistence_QOM_AndInterface) {
                        $sql['where'][] = '(';
                        $this->parseConstraint($constraint->getConstraint1(), $source, $sql, $parameters);
-                       $sql['where'][] = ' AND ';                                                      
+                       $sql['where'][] = ' AND ';
                        $this->parseConstraint($constraint->getConstraint2(), $source, $sql, $parameters);
-                       $sql['where'][] = ')';                                                          
-               } elseif ($constraint instanceof Tx_Extbase_Persistence_QOM_OrInterface) {          
-                       $sql['where'][] = '(';                                                          
+                       $sql['where'][] = ')';
+               } elseif ($constraint instanceof Tx_Extbase_Persistence_QOM_OrInterface) {
+                       $sql['where'][] = '(';
                        $this->parseConstraint($constraint->getConstraint1(), $source, $sql, $parameters);
-                       $sql['where'][] = ' OR ';                                                       
+                       $sql['where'][] = ' OR ';
                        $this->parseConstraint($constraint->getConstraint2(), $source, $sql, $parameters);
                        $sql['where'][] = ')';
                } elseif ($constraint instanceof Tx_Extbase_Persistence_QOM_NotInterface) {
@@ -495,7 +508,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        // this else branch enables equals() to behave like in(). This behavior is deprecated and will be removed in future. Use in() instead.
                        $operator = Tx_Extbase_Persistence_QueryInterface::OPERATOR_IN;
                }
-                               
+
                if ($operator === Tx_Extbase_Persistence_QueryInterface::OPERATOR_IN) {
                        $items = array();
                        $hasValue = FALSE;
@@ -555,7 +568,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        $parameters[] = $this->getPlainValue($operand2);
                }
        }
-       
+
        /**
         * Returns a plain value, i.e. objects are flattened out if possible.
         *
@@ -616,10 +629,10 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                                $constraintSQL .= $valueFunction . '(' . (!empty($tableName) ? $tableName . '.' : '') . $columnName .  ' ' . $operator . ' ?';
                        }
 
-                       $sql['where'][] = $constraintSQL;                       
+                       $sql['where'][] = $constraintSQL;
                }
        }
-       
+
        protected function addUnionStatement(&$className, &$tableName, &$propertyPath, array &$sql) {
                $explodedPropertyPath = explode('.', $propertyPath, 2);
                $propertyName = $explodedPropertyPath[0];
@@ -779,7 +792,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        }
                }
        }
-       
+
        /**
         * Builds the language field statement
         *
@@ -794,7 +807,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        }
                }
        }
-       
+
        /**
         * Builds the page ID checking statement
         *
@@ -807,8 +820,8 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        $this->tableInformationCache[$tableName]['columnNames'] = $this->databaseHandle->admin_get_fields($tableName);
                }
                if (is_array($GLOBALS['TCA'][$tableName]['ctrl']) && array_key_exists('pid', $this->tableInformationCache[$tableName]['columnNames'])) {
-                       $extbaseFrameworkConfiguration = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
-                       $sql['additionalWhereClause'][] = $tableName . '.pid IN (' . implode(', ', t3lib_div::intExplode(',', $extbaseFrameworkConfiguration['persistence']['storagePid'])) . ')';
+                       $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+                       $sql['additionalWhereClause'][] = $tableName . '.pid IN (' . implode(', ', t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid'])) . ')';
                }
        }
 
@@ -886,8 +899,8 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        }
                }
                return $rows;
-       } 
-       
+       }
+
        /**
         * Performs workspace and language overlay on the given row array. The language and workspace id is automatically
         * detected (depending on FE or BE context). You can also explicitly set the language/workspace id.
@@ -977,13 +990,13 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
         * @return void
         */
        protected function clearPageCache($tableName, $uid) {
-               $extbaseSettings = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
-               if (isset($extbaseSettings['persistence']['enableAutomaticCacheClearing']) && $extbaseSettings['persistence']['enableAutomaticCacheClearing'] === '1') {
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if (isset($frameworkConfiguration['persistence']['enableAutomaticCacheClearing']) && $frameworkConfiguration['persistence']['enableAutomaticCacheClearing'] === '1') {
                } else {
                        // if disabled, return
                        return;
                }
-               
+
                $pageIdsToClear = array();
                $storagePage = NULL;
 
@@ -1016,7 +1029,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        }
                }
 
-               // TODO check if we can hand this over to the Dispatcher to clear the page only once, this will save around 10% time while inserting and updating 
+               // TODO check if we can hand this over to the Dispatcher to clear the page only once, this will save around 10% time while inserting and updating
                Tx_Extbase_Utility_Cache::clearPageCache($pageIdsToClear);
        }
 }
index 4c61719..9d673c0 100644 (file)
@@ -31,6 +31,7 @@
  * @version $Id$
  * @api
  */
+// FIXME This class should be a Prototype
 class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
 
        /**
@@ -43,7 +44,7 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
        /**
         * @var t3lib_cache_frontend_VariableFrontend
         */
-       protected $cache;
+       protected $dataCache;
 
        /**
         * Whether class alterations should be detected on each initialization.
@@ -121,7 +122,7 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
         *
         * @var boolean
         */
-       protected $cacheNeedsUpdate = FALSE;
+       protected $dataCacheNeedsUpdate = FALSE;
 
        /**
         * Local cache for Class schemata
@@ -130,15 +131,15 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
        protected $classSchemata = array();
 
        /**
-        * Sets the cache.
+        * Sets the data cache.
         *
         * The cache must be set before initializing the Reflection Service.
         *
-        * @param t3lib_cache_frontend_VariableFrontend $cache Cache for the Reflection service
+        * @param t3lib_cache_frontend_VariableFrontend $dataCache Cache for the Reflection service
         * @return void
         */
-       public function setCache(t3lib_cache_frontend_VariableFrontend $cache) {
-               $this->cache = $cache;
+       public function setDataCache(t3lib_cache_frontend_VariableFrontend $dataCache) {
+               $this->dataCache = $dataCache;
        }
 
        /**
@@ -170,7 +171,7 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
         * @return void
         */
        public function shutdown() {
-               if ($this->cacheNeedsUpdate) {
+               if ($this->dataCacheNeedsUpdate) {
                        $this->saveToCache();
                }
        }
@@ -360,7 +361,7 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
                }
                ksort($this->reflectedClassNames);
 
-               $this->cacheNeedsUpdate = TRUE;
+               $this->dataCacheNeedsUpdate = TRUE;
        }
 
        /**
@@ -399,7 +400,7 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
                        }
                }
                $this->classSchemata[$className] = $classSchema;
-               $this->cacheNeedsUpdate = TRUE;
+               $this->dataCacheNeedsUpdate = TRUE;
                return $classSchema;
        }
 
@@ -450,7 +451,7 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
        protected function getMethodReflection($className, $methodName) {
                if (!isset($this->methodReflections[$className][$methodName])) {
                        $this->methodReflections[$className][$methodName] = new Tx_Extbase_Reflection_MethodReflection($className, $methodName);
-                       $this->cacheNeedsUpdate = TRUE;
+                       $this->dataCacheNeedsUpdate = TRUE;
                }
                return $this->methodReflections[$className][$methodName];
        }
@@ -461,9 +462,8 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
         * @return void
         */
        protected function loadFromCache() {
-               $cacheKey = $this->getCacheKey();
-               if ($this->cache->has($cacheKey)) {
-                       $data = $this->cache->get($cacheKey);
+               if ($this->dataCache->has('ReflectionData')) {
+                       $data = $this->dataCache->get('ReflectionData');
                        foreach ($data as $propertyName => $propertyValue) {
                                $this->$propertyName = $propertyValue;
                        }
@@ -476,7 +476,7 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
         * @return void
         */
        protected function saveToCache() {
-               if (!is_object($this->cache)) {
+               if (!is_object($this->dataCache)) {
                        throw new Tx_Extbase_Reflection_Exception(
                                'A cache must be injected before initializing the Reflection Service.',
                                1232044697
@@ -497,19 +497,8 @@ class Tx_Extbase_Reflection_Service implements t3lib_Singleton {
                foreach ($propertyNames as $propertyName) {
                        $data[$propertyName] = $this->$propertyName;
                }
-               $this->cache->set($this->getCacheKey(), $data);
+               $this->dataCache->set('ReflectionData', $data);
        }
 
-       /**
-        * Get the name of the cache row identifier. Incorporates the extension name
-        * and the plugin name so that all information which is needed for a single
-        * plugin can be found in one cache row.
-        *
-        * @return string
-        */
-       protected function getCacheKey() {
-               $frameworkConfiguration = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
-               return $frameworkConfiguration['extensionName'] . '_' . $frameworkConfiguration['pluginName'];
-       }
 }
 ?>
\ No newline at end of file
index c6aceac..ec2ac19 100644 (file)
@@ -44,7 +44,7 @@ class Tx_Extbase_Utility_ExtbaseRequirementsCheck implements tx_reports_StatusPr
                $reports = array(
                        'docCommentsShouldBePreserved' => $this->checkIfDocCommentsArePreserved()
                );
-               
+
                return $reports;
        }
 
@@ -55,7 +55,7 @@ class Tx_Extbase_Utility_ExtbaseRequirementsCheck implements tx_reports_StatusPr
         */
        protected function checkIfDocCommentsArePreserved() {
 
-               $method = new ReflectionMethod('Tx_Extbase_Dispatcher', 'dispatch');
+               $method = new ReflectionMethod('Tx_Extbase_MVC_Dispatcher', 'dispatch');
 
                if(strlen($method->getDocComment()) > 0) {
                        $value = 'Preserved';
index ce0dd43..4f5e0c5 100644 (file)
@@ -106,7 +106,7 @@ class Tx_Extbase_Utility_Extension {
                $pluginContent = trim('
 tt_content.list.20.' . $pluginSignature . ' = USER
 tt_content.list.20.' . $pluginSignature . ' {
-       userFunc = tx_extbase_dispatcher->dispatch
+       userFunc = tx_extbase_core_bootstrap->run
        pluginName = ' . $pluginName . '
        extensionName = ' . $extensionName . '
        ' . $controller .
@@ -265,7 +265,7 @@ tt_content.list.20.' . $pluginSignature . ' {
                }
 
                if ((strlen($sub) > 0)) {
-                       $sub = $extensionName . self::convertLowerUnderscoreToUpperCamelCase($sub);
+                       //$sub = $extensionName . self::convertLowerUnderscoreToUpperCamelCase($sub);
                        $key = $main . '_' . $sub;
                } else {
                        $key = $main;
@@ -309,12 +309,13 @@ tt_content.list.20.' . $pluginSignature . ' {
         *
         * @param       string  $extensionKey   Key of the extension
         * @param       string  $extensionPath  full path of the extension
+        * @param   array   $additionalAutoloadClasses additional classes to be added to the autoloader. The key must be the classname all-lowercase, the value must be the entry to be inserted
         * @return      string  HTML string which should be outputted
         */
-       public function createAutoloadRegistryForExtension($extensionKey, $extensionPath) {
+       public static function createAutoloadRegistryForExtension($extensionKey, $extensionPath, $additionalAutoloadClasses = array()) {
                $classNameToFileMapping = array();
                $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionKey)));
-               $errors = $this->buildAutoloadRegistryForSinglePath($classNameToFileMapping, $extensionPath . 'Classes/', '.*tslib.*', '$extensionClassesPath . \'|\'');
+               $errors = self::buildAutoloadRegistryForSinglePath($classNameToFileMapping, $extensionPath . 'Classes/', '.*tslib.*', '$extensionClassesPath . \'|\'');
                if ($errors) {
                        return $errors;
                }
@@ -327,7 +328,8 @@ tt_content.list.20.' . $pluginSignature . ' {
                                unset($classNameToFileMapping[$className]);
                        }
                }
-               $autoloadFileString = $this->generateAutoloadPHPFileData($classNameToFileMapping, $globalPrefix);
+               $classNameToFileMapping = array_merge($classNameToFileMapping, $additionalAutoloadClasses);
+               $autoloadFileString = self::generateAutoloadPHPFileData($classNameToFileMapping, $globalPrefix);
                if (!@file_put_contents($extensionPath . 'ext_autoload.php', $autoloadFileString)) {
                        $errors[] = '<b>' . $extensionPath . 'ext_autoload.php could not be written!</b>';
                }
@@ -367,14 +369,14 @@ tt_content.list.20.' . $pluginSignature . ' {
         * @param       string  $valueWrap      Wrap for the file name
         * @return void
         */
-       protected function buildAutoloadRegistryForSinglePath(&$classNameToFileMapping, $path, $excludeRegularExpression = '', $valueWrap = '\'|\'') {
+       protected static function buildAutoloadRegistryForSinglePath(&$classNameToFileMapping, $path, $excludeRegularExpression = '', $valueWrap = '\'|\'') {
 //             if (file_exists($path . 'Classes/')) {
 //                     return "<b>This appears to be a new-style extension which has its PHP classes inside the Classes/ subdirectory. It is not needed to generate the autoload registry for these extensions.</b>";
 //             }
                $extensionFileNames = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(), $path, 'php', FALSE, 99, $excludeRegularExpression), $path);
 
                foreach ($extensionFileNames as $extensionFileName) {
-                       $classNamesInFile = $this->extractClassNames($path . $extensionFileName);
+                       $classNamesInFile = self::extractClassNames($path . $extensionFileName);
                        if (!count($classNamesInFile)) continue;
                        foreach ($classNamesInFile as $className) {
                                $classNameToFileMapping[strtolower($className)] = str_replace('|', $extensionFileName, $valueWrap);
@@ -388,24 +390,24 @@ tt_content.list.20.' . $pluginSignature . ' {
         * @param       string  $filePath       File path (absolute)
         * @return      array   Class names
         */
-       protected function extractClassNames($filePath) {
+       protected static function extractClassNames($filePath) {
                $fileContent = php_strip_whitespace($filePath);
                $classNames = array();
-               if (function_exists('token_get_all')) {
+               if (FALSE) {
                        $tokens = token_get_all($fileContent);
                        while(1) {
                                // look for "class" or "interface"
-                               $token = $this->findToken($tokens, array(T_ABSTRACT, T_CLASS, T_INTERFACE));
+                               $token = self::findToken($tokens, array(T_ABSTRACT, T_CLASS, T_INTERFACE));
                                // fetch "class" token if "abstract" was found
                                if ($token === 'abstract') {
-                                       $token = $this->findToken($tokens, array(T_CLASS));
+                                       $token = self::findToken($tokens, array(T_CLASS));
                                }
                                if ($token === false) {
                                        // end of file
                                        break;
                                }
                                // look for the name (a string) skipping only whitespace and comments
-                               $token = $this->findToken($tokens, array(T_STRING), array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT));
+                               $token = self::findToken($tokens, array(T_STRING), array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT));
                                if ($token === false) {
                                        // unexpected end of file or token: remove found names because of parse error
                                        t3lib_div::sysLog('Parse error in "' . $filePath. '".', 'Core', 2);
@@ -435,7 +437,7 @@ tt_content.list.20.' . $pluginSignature . ' {
         * @param       array   $intermediateTokens     optional: list of tokens that are allowed to skip when looking for the wanted token
         * @return      mixed
         */
-       protected function findToken(array &$tokenList, array $wantedTokens, array $intermediateTokens = array()) {
+       protected static function findToken(array &$tokenList, array $wantedTokens, array $intermediateTokens = array()) {
                $skipAllTokens = count($intermediateTokens) ? false : true;
 
                $returnValue = false;
@@ -461,21 +463,23 @@ tt_content.list.20.' . $pluginSignature . ' {
        }
 
        /**
-        * Determines the plugin namespace of the specified plugin (defaults to "tx_[extensionName]_[pluginName]")
+        * Determines the plugin namespace of the specified plugin (defaults to "tx_[extensionname]_[pluginname]")
         * If plugin.tx_$pluginSignature.view.pluginNamespace is set, this value is returned
-        * If pluginNamespace is not specified "tx_[extensionName]_[pluginName]" is returned.
+        * If pluginNamespace is not specified "tx_[extensionname]_[pluginname]" is returned.
         *
-        * @param string $pluginSignature Plugin signature: strtolower($extensionName) . '_' . strtolower($pluginName)
+        * @param string $extensionName name of the extension to retrieve the namespace for
+        * @param string $pluginName name of the plugin to retrieve the namespace for
         * @return string plugin namespace
         */
-       public static function getPluginNamespaceByPluginSignature($pluginSignature) {
+       public static function getPluginNamespace($extensionName, $pluginName) {
+               $pluginSignature = strtolower($extensionName . '_' . $pluginName);
                $defaultPluginNamespace = 'tx_' . $pluginSignature;
-               $configurationManager = Tx_Extbase_Dispatcher::getConfigurationManager();
+               $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
+               $configurationManager = $objectManager->get('Tx_Extbase_Configuration_ConfigurationManagerInterface');
                if (!isset($configurationManager) || !isset($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']) || !is_array($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.'])) {
                        return $defaultPluginNamespace;
                }
-               $pluginConfiguration = $GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.'][$pluginSignature . '.'];
-               $frameworkConfiguration = $configurationManager->getFrameworkConfiguration($pluginConfiguration);
+               $frameworkConfiguration = $configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, $extensionName, $pluginName);
                if (!isset($frameworkConfiguration['view']['pluginNamespace']) || empty($frameworkConfiguration['view']['pluginNamespace'])) {
                        return $defaultPluginNamespace;
                }
@@ -528,16 +532,18 @@ tt_content.list.20.' . $pluginSignature . ' {
         * If the page could not be determined, NULL is returned
         * If defaultPid is "auto" and more than one page contains the specified plugin, an Exception is thrown
         *
-        * @param string $pluginSignature Plugin signature: strtolower($extensionName) . '_' . strtolower($pluginName)
+        * @param string $extensionName name of the extension to retrieve the target PID for
+        * @param string $pluginName name of the plugin to retrieve the target PID for
         * @return integer uid of the target page or NULL if target page could not be determined
         */
-       public static function getTargetPidByPluginSignature($pluginSignature) {
-               $configurationManager = Tx_Extbase_Dispatcher::getConfigurationManager();
+       public static function getTargetPidByPlugin($extensionName, $pluginName) {
+               $pluginSignature = strtolower($extensionName . '_' . $pluginName);
+               $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
+               $configurationManager = $objectManager->get('Tx_Extbase_Configuration_ConfigurationManagerInterface');
                if (!isset($configurationManager) || !isset($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']) || !is_array($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.'])) {
                        return NULL;
                }
-               $pluginConfiguration = $GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.'][$pluginSignature . '.'];
-               $frameworkConfiguration = $configurationManager->getFrameworkConfiguration($pluginConfiguration);
+               $frameworkConfiguration = $configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, $extensionName, $pluginName);
                if (!isset($frameworkConfiguration['view']['defaultPid']) || empty($frameworkConfiguration['view']['defaultPid'])) {
                        return NULL;
                }
index 8f230cb..bb5c9f0 100644 (file)
@@ -78,7 +78,7 @@ class Tx_Extbase_Utility_Localization {
         * @api
         * @todo: If vsprintf gets a malformed string, it returns FALSE! Should we throw an exception there?
         */
-       public function translate($key, $extensionName, $arguments = NULL) {
+       static public function translate($key, $extensionName, $arguments = NULL) {
                if (t3lib_div::isFirstPartOfStr($key, 'LLL:')) {
                        $value = self::translateFileReference($key);
                } else {
@@ -184,11 +184,13 @@ class Tx_Extbase_Utility_Localization {
         * @author Bastian Waidelich <bastian@typo3.org>
         */
        protected function loadTypoScriptLabels($extensionName) {
-               $extbaseFrameworkConfiguration = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
-               if (!is_array($extbaseFrameworkConfiguration['_LOCAL_LANG'])) {
+               $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
+               $configurationManager = $objectManager->get('Tx_Extbase_Configuration_ConfigurationManagerInterface');
+               $frameworkConfiguration = $configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if (!is_array($frameworkConfiguration['_LOCAL_LANG'])) {
                        return;
                }
-               foreach ($extbaseFrameworkConfiguration['_LOCAL_LANG'] as $languageKey => $labels) {
+               foreach ($frameworkConfiguration['_LOCAL_LANG'] as $languageKey => $labels) {
                        if (!is_array($labels)) {
                                continue;
                        }
index cf982e2..1420891 100644 (file)
@@ -71,7 +71,7 @@ class Tx_Extbase_Configuration_BackendConfigurationManager_testcase extends Tx_E
        /**
         * @test
         */
-       public function loadTypoScriptSetupCantBeTested() {
+       public function getTypoScriptSetupCanBeTested() {
                $this->markTestIncomplete('This method can\'t be tested with the current TYPO3 version, because we can\'t mock objects returned from t3lib_div::makeInstance().');
        }
 
index fb663c4..778fffb 100644 (file)
@@ -54,9 +54,9 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager_testcase extends Tx_
        /**
         * @test
         */
-       public function loadTypoScriptSetupReturnsSetupFromTSFE() {
+       public function getTypoScriptSetupReturnsSetupFromTSFE() {
                $GLOBALS['TSFE']->tmpl->setup = array('foo' => 'bar');
-               $this->assertEquals(array('foo' => 'bar'), $this->frontendConfigurationManager->loadTypoScriptSetup());
+               $this->assertEquals(array('foo' => 'bar'), $this->frontendConfigurationManager->_callRef('getTypoScriptSetup'));
        }
 
        /**
diff --git a/typo3/sysext/extbase/Tests/Fixtures/Dispatcher.php b/typo3/sysext/extbase/Tests/Fixtures/Dispatcher.php
deleted file mode 100644 (file)
index 59145ff..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  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!
-***************************************************************/
-
-/**
- * Creates a request an dispatches it to the controller which was specified
- * by TS Setup, Flexform and returns the content to the v4 framework.
- *
- * This class is the main entry point for extbase extensions.
- *
- * @package Extbase
- */
-class Tx_Extbase_Tests_Fixtures_Dispatcher extends Tx_Extbase_Dispatcher {
-
-       /**
-        * sets the configuration manager
-        */
-       public function setConfigurationManager(Tx_Extbase_Configuration_AbstractConfigurationManager $configurationManager) {
-               parent::$configurationManager = $configurationManager;
-       }
-
-}
-?>
\ No newline at end of file
index 876b9ac..1348007 100644 (file)
@@ -49,7 +49,7 @@ class Tx_Extbase_MVC_Controller_ActionController_testcase extends Tx_Extbase_Bas
                $mockController->expects($this->at(3))->method('initializeAction');
                $mockController->expects($this->at(4))->method('initializeFooAction');
                $mockController->expects($this->at(5))->method('mapRequestArgumentsToControllerArguments');
-                $mockController->expects($this->at(6))->method('checkRequestHash');
+               $mockController->expects($this->at(6))->method('checkRequestHash');
                $mockController->expects($this->at(7))->method('resolveView')->will($this->returnValue($mockView));
                $mockController->expects($this->at(8))->method('initializeView');
                $mockController->expects($this->at(9))->method('callActionMethod');
@@ -179,7 +179,7 @@ class Tx_Extbase_MVC_Controller_ActionController_testcase extends Tx_Extbase_Bas
                $mockFluidTemplateView->expects($this->once())->method('hasTemplate')->will($this->returnValue(TRUE));
 
                $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));
+               $mockObjectManager->expects($this->at(0))->method('get')->with('Tx_Fluid_View_TemplateView')->will($this->returnValue($mockFluidTemplateView));
 
                $mockController = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_MVC_Controller_ActionController'), array('buildControllerContext'), array(), '', FALSE);
                $mockController->expects($this->once())->method('buildControllerContext')->will($this->returnValue($mockControllerContext));
index f000b80..218fd26 100644 (file)
@@ -105,7 +105,7 @@ class Tx_Extbase_MVC_Controller_Argument_testcase extends Tx_Extbase_BaseTestCas
                $this->markTestIncomplete();
 
                $this->mockObjectManager->expects($this->once())->method('isObjectRegistered')->with('Tx_Extbase_Validation_Validator_TextValidator')->will($this->returnValue(TRUE));
-               $this->mockObjectManager->expects($this->any())->method('getObject')->with('Tx_Extbase_Validation_Validator_TextValidator')->will($this->returnValue($this->getMock('Tx_Extbase_Validation_Validator_TextValidator')));
+               $this->mockObjectManager->expects($this->any())->method('get')->with('Tx_Extbase_Validation_Validator_TextValidator')->will($this->returnValue($this->getMock('Tx_Extbase_Validation_Validator_TextValidator')));
 
                $argument = new Tx_Extbase_MVC_Controller_Argument('SomeArgument', 'Tx_Extbase_Validation_Validator_TextValidator');
                $argument->injectObjectManager($this->mockObjectManager);
@@ -120,7 +120,7 @@ class Tx_Extbase_MVC_Controller_Argument_testcase extends Tx_Extbase_BaseTestCas
                $this->markTestIncomplete();
 
                $this->mockObjectManager->expects($this->once())->method('isObjectRegistered')->with('Tx_Extbase_Validation_Validator_TextValidator')->will($this->returnValue(TRUE));
-               $this->mockObjectManager->expects($this->any())->method('getObject')->with('Tx_Extbase_Validation_Validator_TextValidator')->will($this->returnValue($this->getMock('Tx_Extbase_Validation_Validator_TextValidator')));
+               $this->mockObjectManager->expects($this->any())->method('get')->with('Tx_Extbase_Validation_Validator_TextValidator')->will($this->returnValue($this->getMock('Tx_Extbase_Validation_Validator_TextValidator')));
 
                $argument = new Tx_Extbase_MVC_Controller_Argument('SomeArgument', 'Text');
                $argument->injectObjectManager($this->mockObjectManager);
index 69a3f07..ac69e94 100644 (file)
@@ -31,8 +31,8 @@ class Tx_Extbase_MVC_Controller_Arguments_testcase extends Tx_Extbase_BaseTestCa
         * @test
         */
        public function argumentsObjectIsOfScopePrototype() {
-               $arguments1 = $this->objectManager->getObject('Tx_Extbase_MVC_Controller_Arguments');
-               $arguments2 = $this->objectManager->getObject('Tx_Extbase_MVC_Controller_Arguments');
+               $arguments1 = $this->objectManager->get('Tx_Extbase_MVC_Controller_Arguments');
+               $arguments2 = $this->objectManager->get('Tx_Extbase_MVC_Controller_Arguments');
                $this->assertNotSame($arguments1, $arguments2, 'The arguments object is not of scope prototype!');
        }
 
@@ -40,8 +40,8 @@ class Tx_Extbase_MVC_Controller_Arguments_testcase extends Tx_Extbase_BaseTestCa
         * @test
         */
        public function addingAnArgumentManuallyWorks() {
-               $arguments = $this->objectManager->getObject('Tx_Extbase_MVC_Controller_Arguments');
-               $newArgument = $this->objectManager->getObject('Tx_Extbase_MVC_Controller_Argument', 'argumentName1234', 'dummyValue');
+               $arguments = $this->objectManager->get('Tx_Extbase_MVC_Controller_Arguments');
+               $newArgument = $this->objectManager->get('Tx_Extbase_MVC_Controller_Argument', 'argumentName1234', 'dummyValue');
 
                $arguments->addArgument($newArgument);
                $this->assertSame($newArgument, $arguments->getArgument('argumentName1234'), 'The added and retrieved argument is not the same.');
@@ -105,7 +105,7 @@ class Tx_Extbase_MVC_Controller_Arguments_testcase extends Tx_Extbase_BaseTestCa
         * @test
         */
        public function getArgumentWithNonExistingArgumentNameThrowsException() {
-               $arguments = $this->objectManager->getObject('Tx_Extbase_MVC_Controller_Arguments');
+               $arguments = $this->objectManager->get('Tx_Extbase_MVC_Controller_Arguments');
                try {
                        $arguments->getArgument('someArgument');
                        $this->fail('getArgument() did not throw an exception although the specified argument does not exist.');
@@ -227,7 +227,7 @@ class Tx_Extbase_MVC_Controller_Arguments_testcase extends Tx_Extbase_BaseTestCa
         * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function callingInvalidMethodThrowsException() {
-               $arguments = $this->objectManager->getObject('Tx_Extbase_MVC_Controller_Arguments');
+               $arguments = $this->objectManager->get('Tx_Extbase_MVC_Controller_Arguments');
                $arguments->nonExistingMethod();
        }
 
diff --git a/typo3/sysext/extbase/Tests/MVC/DispatcherTest.php b/typo3/sysext/extbase/Tests/MVC/DispatcherTest.php
new file mode 100644 (file)
index 0000000..83bba65
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Jochen Rau <jochen.rau@typoplanet.de>
+*  All rights reserved
+*
+*  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!
+***************************************************************/
+
+/**
+ * Testcase for the MVC Dispatcher
+ *
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class Tx_Extbase_MVC_DispatcherTest extends Tx_Extbase_BaseTestCase {
+
+       /**
+        * @test
+        */
+       public function dispatchCallsTheControllersProcessRequestMethodUntilTheIsDispatchedFlagInTheRequestObjectIsSet() {
+               $mockRequest = $this->getMock('Tx_Extbase_MVC_RequestInterface');
+               $mockRequest->expects($this->at(0))->method('isDispatched')->will($this->returnValue(FALSE));
+               $mockRequest->expects($this->at(1))->method('isDispatched')->will($this->returnValue(FALSE));
+               $mockRequest->expects($this->at(2))->method('isDispatched')->will($this->returnValue(TRUE));
+       
+               $mockResponse = $this->getMock('Tx_Extbase_MVC_ResponseInterface');
+       
+               $mockController = $this->getMock('Tx_Extbase_MVC_Controller_ControllerInterface', array('processRequest', 'canProcessRequest'));
+               $mockController->expects($this->exactly(2))->method('processRequest')->with($mockRequest, $mockResponse);
+       
+               $dispatcher = $this->getMock('Tx_Extbase_MVC_Dispatcher', array('resolveController'), array(), '', FALSE);
+               $dispatcher->expects($this->any())->method('resolveController')->will($this->returnValue($mockController));
+               $dispatcher->dispatch($mockRequest, $mockResponse);
+       }
+       
+       /**
+        * @test
+        * @expectedException Tx_Extbase_MVC_Exception_InfiniteLoop
+        */
+       public function dispatchThrowsAnInfiniteLoopExceptionIfTheRequestCouldNotBeDispachedAfter99Iterations() {
+               $requestCallCounter = 0;
+               $requestCallBack = function() use (&$requestCallCounter) {
+                       return ($requestCallCounter++ < 101) ? FALSE : TRUE;
+               };
+               $mockRequest = $this->getMock('Tx_Extbase_MVC_RequestInterface');
+               $mockRequest->expects($this->any())->method('isDispatched')->will($this->returnCallBack($requestCallBack, '__invoke'));
+
+               $mockResponse = $this->getMock('Tx_Extbase_MVC_ResponseInterface');
+               $mockController = $this->getMock('Tx_Extbase_MVC_Controller_ControllerInterface', array('processRequest', 'canProcessRequest'));
+
+               $dispatcher = $this->getMock('Tx_Extbase_MVC_Dispatcher', array('resolveController'), array(), '', FALSE);
+               $dispatcher->expects($this->any())->method('resolveController')->will($this->returnValue($mockController));
+               $dispatcher->dispatch($mockRequest, $mockResponse);
+       }
+       
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Tests/Object/Container/ClassInfoFactoryTest.php b/typo3/sysext/extbase/Tests/Object/Container/ClassInfoFactoryTest.php
new file mode 100644 (file)
index 0000000..35f022e
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*  (c) 2010 Daniel Pötzinger
+*  (c) 2010 Bastian Waidelich <bastian@typo3.org>
+*  All rights reserved
+*
+*  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!
+***************************************************************/
+
+require_once(t3lib_extMgm::extPath('extbase') . 'Tests/Object/Container/Fixtures/Testclasses.php');
+
+/**
+ * Testcase for class t3lib_object_ClassInfoFactory.
+ *
+ * @author Daniel Pötzinger
+ * @author Bastian Waidelich <bastian@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class Tx_Extbase_Object_Container_ClassInfoFactoryTest extends tx_phpunit_testcase {
+
+       /**
+        * @var t3lib_object_ClassInfoFactory
+        */
+       private $classInfoFactory;
+
+       /**
+        *
+        */
+       public function setUp() {
+               $this->classInfoFactory = new Tx_Extbase_Object_Container_ClassInfoFactory();
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Tests/Object/Container/ContainerTest.php b/typo3/sysext/extbase/Tests/Object/Container/ContainerTest.php
new file mode 100644 (file)
index 0000000..0b95cb8
--- /dev/null
@@ -0,0 +1,164 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*  (c) 2010 Daniel Pötzinger
+*  (c) 2010 Bastian Waidelich <bastian@typo3.org>
+*  All rights reserved
+*
+*  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!
+***************************************************************/
+
+require_once(t3lib_extMgm::extPath('extbase') . 'Tests/Object/Container/Fixtures/Testclasses.php');
+
+/**
+ * Testcase for class t3lib_object_Container.
+ *
+ * @author Daniel Pötzinger
+ * @author Bastian Waidelich <bastian@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class Tx_Extbase_Object_Container_ContainerTest extends tx_phpunit_testcase {
+
+       private $container;
+
+       public function setUp() {
+               $this->container = Tx_Extbase_Object_Container_Container::getContainer();
+
+       }
+
+       /**
+        * @test
+        */
+       public function getInstanceReturnsInstanceOfSimpleClass() {
+               $object = $this->container->getInstance('t3lib_object_tests_c');
+               $this->assertType('t3lib_object_tests_c', $object);
+       }
+
+       /**
+        * @test
+        */
+       public function getInstanceReturnsInstanceOfAClassWithDependency() {
+               $object = $this->container->getInstance('t3lib_object_tests_b');
+               $this->assertType('t3lib_object_tests_b', $object);
+       }
+
+       /**
+        * @test
+        */
+       public function getInstanceReturnsInstanceOfAClassWithTwoLevelDependency() {
+               $object = $this->container->getInstance('t3lib_object_tests_a');
+               $this->assertType('t3lib_object_tests_a', $object);
+       }
+
+       /**
+        * @test
+        */
+       public function getInstanceReturnsInstanceOfAClassWithTwoLevelMixedArrayDependency() {
+               $object = $this->container->getInstance('t3lib_object_tests_amixed_array');
+               $this->assertType('t3lib_object_tests_amixed_array', $object);
+       }
+
+       /**
+        * @test
+        */
+       public function getInstanceReturnsInstanceOfAClassWithTwoLevelMixedStringDependency() {
+               $object = $this->container->getInstance('t3lib_object_tests_amixed_string');
+               $this->assertType('t3lib_object_tests_amixed_string', $object);
+       }
+
+       /**
+        * @test
+        */
+       public function getInstancePassesGivenParameterToTheNewObject() {
+               $mockObject = $this->getMock('t3lib_object_tests_c');
+
+               $object = $this->container->getInstance('t3lib_object_tests_a', $mockObject);
+               $this->assertType('t3lib_object_tests_a', $object);
+               $this->assertSame($mockObject, $object->c);
+       }
+
+       /**
+        * @test
+        */
+       public function getInstanceReturnsAFreshInstanceIfObjectIsNoSingleton() {
+               $object1 = $this->container->getInstance('t3lib_object_tests_a');
+               $object2 = $this->container->getInstance('t3lib_object_tests_a');
+
+               $this->assertNotSame($object1, $object2);
+       }
+
+       /**
+        * @test
+        */
+       public function getInstanceReturnsSameInstanceInstanceIfObjectIsSingleton() {
+               $object1 = $this->container->getInstance('t3lib_object_tests_singleton');
+               $object2 = $this->container->getInstance('t3lib_object_tests_singleton');
+
+               $this->assertSame($object1, $object2);
+       }
+
+       /**
+        * @test
+        * @expectedException Exception
+        */
+       public function getInstanceThrowsExceptionIfObjectContainsCyclicDependency() {
+               $this->container->getInstance('t3lib_object_tests_cyclic1');
+
+       }
+
+       /**
+        * @test
+        * @expectedException Exception
+        */
+       public function getInstanceThrowsExceptionIfClassWasNotFound() {
+               $this->container->getInstance('nonextistingclass_bla');
+
+       }
+
+       /**
+        * @test
+        */
+       public function test_canGetChildClass() {
+               $object = $this->container->getInstance('t3lib_object_tests_b_child');
+               $this->assertType('t3lib_object_tests_b_child', $object);
+       }
+
+       /**
+        * @test
+        */
+       public function test_canInjectInterfaceInClass() {
+               $this->container->registerImplementation('t3lib_object_tests_someinterface', 't3lib_object_tests_someimplementation');
+               $object = $this->container->getInstance('t3lib_object_tests_needsinterface');
+               $this->assertType('t3lib_object_tests_needsinterface', $object);
+       }
+
+       /**
+        * @test
+        */
+       public function test_canBuildCyclicDependenciesWithSetter() {
+               $object = $this->container->getInstance('t3lib_object_tests_resolveablecyclic1');
+               $this->assertType('t3lib_object_tests_resolveablecyclic1', $object);
+               $this->assertType('t3lib_object_tests_resolveablecyclic1', $object->o->o);
+       }
+
+
+
+}
+
+
+?>
diff --git a/typo3/sysext/extbase/Tests/Object/Container/Fixtures/Testclasses.php b/typo3/sysext/extbase/Tests/Object/Container/Fixtures/Testclasses.php
new file mode 100644 (file)
index 0000000..6f09a01
--- /dev/null
@@ -0,0 +1,166 @@
+<?php
+
+/**
+ * a  singleton class
+ *
+ */
+class t3lib_object_tests_singleton implements t3lib_Singleton {
+
+}
+
+/**
+ * test class A that depends on B and C
+ *
+ */
+class t3lib_object_tests_a {
+       public $b;
+       public $c;
+
+       public function __construct( t3lib_object_tests_c $c, t3lib_object_tests_b $b) {
+               $this->b = $b;
+               $this->c = $c;
+       }
+}
+/**
+ * test class A that depends on B and C and has a third default parameter in constructor
+ *
+ */
+class t3lib_object_tests_amixed_array implements t3lib_Singleton {
+       public function __construct(t3lib_object_tests_b $b, t3lib_object_tests_c $c, array $myvalue=array()) {
+
+       }
+}
+/**
+ * test class A that depends on B and C and has a third default parameter in constructor
+ *
+ */
+class t3lib_object_tests_amixed_string implements t3lib_Singleton {
+       public function __construct(t3lib_object_tests_b $b, t3lib_object_tests_c $c, $myvalue='test') {
+
+       }
+}
+/**
+ * test class B that depends on C
+ *
+ */
+class t3lib_object_tests_b implements t3lib_Singleton {
+       public function __construct(t3lib_object_tests_c $c) {
+
+       }
+}
+
+
+/**
+ * test class C without dependencys
+ *
+ */
+class t3lib_object_tests_c implements t3lib_Singleton {
+
+}
+
+/**
+ * test class B-Child that extends Class B (therfore depends also on Class C)
+ *
+ */
+class t3lib_object_tests_b_child extends t3lib_object_tests_b {
+}
+
+interface t3lib_object_tests_someinterface {
+
+}
+
+/**
+ * class which implements a Interface
+ *
+ */
+class t3lib_object_tests_someimplementation implements t3lib_object_tests_someinterface, t3lib_Singleton {
+}
+
+/**
+ * test class B-Child that extends Class B (therfore depends also on Class C)
+ *
+ */
+class t3lib_object_tests_b_child_someimplementation extends t3lib_object_tests_b implements t3lib_object_tests_someinterface {
+}
+
+/**
+ * class which depends on a Interface
+ *
+ */
+class t3lib_object_tests_needsinterface {
+       public function __construct(t3lib_object_tests_someinterface $i) {
+
+       }
+}
+
+/**
+ * classes that depends on each other (death look)
+ *
+ */
+class t3lib_object_tests_cyclic1 {
+       public function __construct(t3lib_object_tests_cyclic2 $c) {
+
+       }
+}
+
+class t3lib_object_tests_cyclic2 {
+       public function __construct(t3lib_object_tests_cyclic1 $c) {
+
+       }
+}
+
+/**
+ * class which has setter injections defined
+ *
+ */
+class t3lib_object_tests_injectmethods {
+       public $b;
+       public $bchild;
+
+       public function injectClassB(t3lib_object_tests_b $o) {
+               $this->b = $o;
+       }
+
+       /**
+        * @inject
+        * @param t3lib_object_tests_b $o
+        */
+       public function setClassBChild(t3lib_object_tests_b_child $o) {
+               $this->bchild = $o;
+       }
+}
+
+/**
+ * class which needs extenson settings injected
+ *
+ */
+class t3lib_object_tests_injectsettings {
+       public $settings;
+       public function injectExtensionSettings(array $settings) {
+               $this->settings = $settings;
+       }
+}
+
+/**
+ *
+ *
+ */
+class t3lib_object_tests_resolveablecyclic1 implements t3lib_Singleton {
+       public $o;
+       public function __construct(t3lib_object_tests_resolveablecyclic2 $cyclic2) {
+               $this->o = $cyclic2;
+       }
+}
+
+/**
+ *
+ *
+ */
+class t3lib_object_tests_resolveablecyclic2 implements t3lib_Singleton {
+       public $o;
+       public function injectCyclic1(t3lib_object_tests_resolveablecyclic1 $o) {
+               $this->o = $o;
+       }
+}
+
+
index f8d4265..5ed56e5 100644 (file)
@@ -22,8 +22,6 @@
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 
-require_once (t3lib_extMgm::extPath('extbase') . 'Tests/Fixtures/Dispatcher.php');
-
 /**
  * Testcase for class Tx_Extbase_Utility_Extension
  *
@@ -376,9 +374,9 @@ tt_content.list.20.myextension_pi1 {', $staticTypoScript);
         * @dataProvider getPluginNamespaceByPluginSignatureDataProvider
         */
        public function getPluginNamespaceByPluginSignatureTests($pluginSignature, $expectedResult) {
-               $dispatcher = new Tx_Extbase_Tests_Fixtures_Dispatcher();
-               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_AbstractConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'loadTypoScriptSetup'));
-               $dispatcher->setConfigurationManager($mockConfigurationManager);
+               $dispatcher = new Tx_Extbase_Dispatcher();
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup'));
+               $dispatcher->injectConfigurationManager($mockConfigurationManager);
                $actualResult = Tx_Extbase_Utility_Extension::getPluginNamespaceByPluginSignature($pluginSignature);
                $this->assertEquals($expectedResult, $actualResult, 'Failing for $pluginSignature: "' . $pluginSignature . '"');
        }
@@ -387,10 +385,10 @@ tt_content.list.20.myextension_pi1 {', $staticTypoScript);
         * @test
         */
        public function pluginNamespaceCanBeOverridden() {
-               $dispatcher = new Tx_Extbase_Tests_Fixtures_Dispatcher();
-               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_AbstractConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'loadTypoScriptSetup', 'getFrameworkConfiguration'));
-               $mockConfigurationManager->expects($this->once())->method('getFrameworkConfiguration')->will($this->returnValue(array('view' => array('pluginNamespace' => 'overridden_plugin_namespace'))));
-               $dispatcher->setConfigurationManager($mockConfigurationManager);
+               $dispatcher = new Tx_Extbase_Dispatcher();
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getConfiguration'));
+               $mockConfigurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue(array('view' => array('pluginNamespace' => 'overridden_plugin_namespace'))));
+               $dispatcher->injectConfigurationManager($mockConfigurationManager);
                $expectedResult = 'overridden_plugin_namespace';
                $actualResult = Tx_Extbase_Utility_Extension::getPluginNamespaceByPluginSignature('somePluginSignature');
                $this->assertEquals($expectedResult, $actualResult);
@@ -440,10 +438,10 @@ tt_content.list.20.myextension_pi1 {', $staticTypoScript);
         * @test
         */
        public function getTargetPidByPluginSignatureReturnsNullIfDefaultPidIsNotConfigured() {
-               $dispatcher = new Tx_Extbase_Tests_Fixtures_Dispatcher();
-               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_AbstractConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'loadTypoScriptSetup', 'getFrameworkConfiguration'));
-               $mockConfigurationManager->expects($this->once())->method('getFrameworkConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array()));
-               $dispatcher->setConfigurationManager($mockConfigurationManager);
+               $dispatcher = new Tx_Extbase_Dispatcher();
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getConfiguration'));
+               $mockConfigurationManager->expects($this->once())->method('getConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array()));
+               $dispatcher->injectConfigurationManager($mockConfigurationManager);
                $this->assertNull(Tx_Extbase_Utility_Extension::getTargetPidByPluginSignature('extensionname_someplugin'));
        }
 
@@ -451,10 +449,10 @@ tt_content.list.20.myextension_pi1 {', $staticTypoScript);
         * @test
         */
        public function getTargetPidByPluginSignatureReturnsTheConfiguredDefaultPid() {
-               $dispatcher = new Tx_Extbase_Tests_Fixtures_Dispatcher();
-               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_AbstractConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'loadTypoScriptSetup', 'getFrameworkConfiguration'));
-               $mockConfigurationManager->expects($this->once())->method('getFrameworkConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => '123'))));
-               $dispatcher->setConfigurationManager($mockConfigurationManager);
+               $dispatcher = new Tx_Extbase_Dispatcher();
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getConfiguration'));
+               $mockConfigurationManager->expects($this->once())->method('getConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => '123'))));
+               $dispatcher->injectConfigurationManager($mockConfigurationManager);
                $expectedResult = 123;
                $actualResult = Tx_Extbase_Utility_Extension::getTargetPidByPluginSignature('extensionname_someplugin');
                $this->assertEquals($expectedResult, $actualResult);
@@ -464,10 +462,10 @@ tt_content.list.20.myextension_pi1 {', $staticTypoScript);
         * @test
         */
        public function getTargetPidByPluginSignatureDeterminesTheTargetPidIfDefaultPidIsAuto() {
-               $dispatcher = new Tx_Extbase_Tests_Fixtures_Dispatcher();
-               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_AbstractConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'loadTypoScriptSetup', 'getFrameworkConfiguration'));
-               $mockConfigurationManager->expects($this->once())->method('getFrameworkConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
-               $dispatcher->setConfigurationManager($mockConfigurationManager);
+               $dispatcher = new Tx_Extbase_Dispatcher();
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getConfiguration'));
+               $mockConfigurationManager->expects($this->once())->method('getConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
+               $dispatcher->injectConfigurationManager($mockConfigurationManager);
                $pluginSignature = 'extensionname_someplugin';
                $GLOBALS['TSFE']->sys_page = $this->getMock('t3lib_pageSelect', array('enableFields'));
                $GLOBALS['TSFE']->sys_page->expects($this->once())->method('enableFields')->with('tt_content')->will($this->returnValue(' AND enable_fields'));
@@ -488,10 +486,10 @@ tt_content.list.20.myextension_pi1 {', $staticTypoScript);
         * @test
         */
        public function getTargetPidByPluginSignatureReturnsNullIfTargetPidCouldNotBeDetermined() {
-               $dispatcher = new Tx_Extbase_Tests_Fixtures_Dispatcher();
-               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_AbstractConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'loadTypoScriptSetup', 'getFrameworkConfiguration'));
-               $mockConfigurationManager->expects($this->once())->method('getFrameworkConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
-               $dispatcher->setConfigurationManager($mockConfigurationManager);
+               $dispatcher = new Tx_Extbase_Dispatcher();
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getConfiguration'));
+               $mockConfigurationManager->expects($this->once())->method('getConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
+               $dispatcher->injectConfigurationManager($mockConfigurationManager);
                $GLOBALS['TSFE']->sys_page = $this->getMock('t3lib_pageSelect', array('enableFields'));
                $GLOBALS['TSFE']->sys_page->expects($this->once())->method('enableFields')->will($this->returnValue(' AND enable_fields'));
                $GLOBALS['TYPO3_DB']->expects($this->once())->method('fullQuoteStr')->will($this->returnValue('"pluginSignature"'));
@@ -504,10 +502,10 @@ tt_content.list.20.myextension_pi1 {', $staticTypoScript);
         * @expectedException Tx_Extbase_Exception
         */
        public function getTargetPidByPluginSignatureThrowsExceptionIfMoreThanOneTargetPidsWereFound() {
-               $dispatcher = new Tx_Extbase_Tests_Fixtures_Dispatcher();
-               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_AbstractConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'loadTypoScriptSetup', 'getFrameworkConfiguration'));
-               $mockConfigurationManager->expects($this->once())->method('getFrameworkConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
-               $dispatcher->setConfigurationManager($mockConfigurationManager);
+               $dispatcher = new Tx_Extbase_Dispatcher();
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManager', array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getConfiguration'));
+               $mockConfigurationManager->expects($this->once())->method('getConfiguration')->with($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['extensionname_someplugin.'])->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
+               $dispatcher->injectConfigurationManager($mockConfigurationManager);
                $GLOBALS['TSFE']->sys_page = $this->getMock('t3lib_pageSelect', array('enableFields'));
                $GLOBALS['TSFE']->sys_page->expects($this->once())->method('enableFields')->will($this->returnValue(' AND enable_fields'));
                $GLOBALS['TYPO3_DB']->expects($this->once())->method('fullQuoteStr')->will($this->returnValue('"pluginSignature"'));
index 4f5d03c..6d76224 100644 (file)
@@ -74,7 +74,7 @@ class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_BaseTe
                $mockValidator->expects($this->once())->method('setOptions')->with(array('foo' => 'bar'));
 
                $mockObjectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
-               $mockObjectManager->expects($this->any())->method('getObject')->with($className)->will($this->returnValue($mockValidator));
+               $mockObjectManager->expects($this->any())->method('get')->with($className)->will($this->returnValue($mockValidator));
 
                $validatorResolver = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Validation_ValidatorResolver'),array('resolveValidatorObjectName'));
                $validatorResolver->_set('objectManager', $mockObjectManager);
@@ -275,7 +275,7 @@ class Tx_Extbase_Validation_ValidatorResolver_testcase extends Tx_Extbase_BaseTe
                $mockConjunctionValidator->expects($this->once())->method('addValidator')->with($mockObjectValidator);
 
                $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));
+               $mockObjectManager->expects($this->at(0))->method('get')->with('Tx_Extbase_Validation_Validator_ConjunctionValidator')->will($this->returnValue($mockConjunctionValidator));
 
                $validatorResolver = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Validation_ValidatorResolver'), array('resolveValidatorObjectName', 'createValidator'));
                $validatorResolver->injectReflectionService($mockReflectionService);
index 3c0f0bc..689d8da 100644 (file)
@@ -1,16 +1,15 @@
 <?php
 // DO NOT CHANGE THIS FILE! It is automatically generated by Tx_Extbase_Utility_Extension::createAutoloadRegistryForExtension.
-// This file was generated on 2010-02-09 16:37
+// This file was generated on 2010-11-10 12:37
 
 $extensionClassesPath = t3lib_extMgm::extPath('extbase') . 'Classes/';
-$extensionTestsPath = t3lib_extMgm::extPath('extbase') . 'Tests/';
 return array(
-       'tx_extbase_basetestcase' => $extensionTestsPath . 'BaseTestCase.php',
-       'tx_extbase_seleniumbasetestcase' => $extensionTestsPath . 'SeleniumBaseTestCase.php',
        'tx_extbase_dispatcher' => $extensionClassesPath . 'Dispatcher.php',
        'tx_extbase_exception' => $extensionClassesPath . 'Exception.php',
        'tx_extbase_configuration_abstractconfigurationmanager' => $extensionClassesPath . 'Configuration/AbstractConfigurationManager.php',
        'tx_extbase_configuration_backendconfigurationmanager' => $extensionClassesPath . 'Configuration/BackendConfigurationManager.php',
+       'tx_extbase_configuration_configurationmanager' => $extensionClassesPath . 'Configuration/ConfigurationManager.php',
+       'tx_extbase_configuration_configurationmanagerinterface' => $extensionClassesPath . 'Configuration/ConfigurationManagerInterface.php',
        'tx_extbase_configuration_exception' => $extensionClassesPath . 'Configuration/Exception.php',
        'tx_extbase_configuration_frontendconfigurationmanager' => $extensionClassesPath . 'Configuration/FrontendConfigurationManager.php',
        'tx_extbase_configuration_exception_containerislocked' => $extensionClassesPath . 'Configuration/Exception/ContainerIsLocked.php',
@@ -18,6 +17,7 @@ return array(
        'tx_extbase_configuration_exception_nosuchfile' => $extensionClassesPath . 'Configuration/Exception/NoSuchFile.php',
        'tx_extbase_configuration_exception_nosuchoption' => $extensionClassesPath . 'Configuration/Exception/NoSuchOption.php',
        'tx_extbase_configuration_exception_parseerror' => $extensionClassesPath . 'Configuration/Exception/ParseError.php',
+       'tx_extbase_core_bootstrap' => $extensionClassesPath . 'Core/Bootstrap.php',
        'tx_extbase_domain_model_frontenduser' => $extensionClassesPath . 'Domain/Model/FrontendUser.php',
        'tx_extbase_domain_model_frontendusergroup' => $extensionClassesPath . 'Domain/Model/FrontendUserGroup.php',
        'tx_extbase_domain_repository_frontendusergrouprepository' => $extensionClassesPath . 'Domain/Repository/FrontendUserGroupRepository.php',
@@ -27,8 +27,11 @@ return array(
        'tx_extbase_domainobject_abstractvalueobject' => $extensionClassesPath . 'DomainObject/AbstractValueObject.php',
        'tx_extbase_domainobject_domainobjectinterface' => $extensionClassesPath . 'DomainObject/DomainObjectInterface.php',
        'tx_extbase_error_error' => $extensionClassesPath . 'Error/Error.php',
+       'tx_extbase_mvc_dispatcher' => $extensionClassesPath . 'MVC/Dispatcher.php',
        'tx_extbase_mvc_exception' => $extensionClassesPath . 'MVC/Exception.php',
        'tx_extbase_mvc_request' => $extensionClassesPath . 'MVC/Request.php',
+       'tx_extbase_mvc_requesthandlerinterface' => $extensionClassesPath . 'MVC/RequestHandlerInterface.php',
+       'tx_extbase_mvc_requesthandlerresolver' => $extensionClassesPath . 'MVC/RequestHandlerResolver.php',
        'tx_extbase_mvc_requestinterface' => $extensionClassesPath . 'MVC/RequestInterface.php',
        'tx_extbase_mvc_response' => $extensionClassesPath . 'MVC/Response.php',
        'tx_extbase_mvc_responseinterface' => $extensionClassesPath . 'MVC/ResponseInterface.php',
@@ -63,7 +66,11 @@ return array(
        'tx_extbase_mvc_exception_unsupportedrequesttype' => $extensionClassesPath . 'MVC/Exception/UnsupportedRequestType.php',
        'tx_extbase_mvc_view_abstractview' => $extensionClassesPath . 'MVC/View/AbstractView.php',
        'tx_extbase_mvc_view_emptyview' => $extensionClassesPath . 'MVC/View/EmptyView.php',
+       'tx_extbase_mvc_view_notfoundview' => $extensionClassesPath . 'MVC/View/NotFoundView.php',
        'tx_extbase_mvc_view_viewinterface' => $extensionClassesPath . 'MVC/View/ViewInterface.php',
+       'tx_extbase_mvc_web_abstractrequesthandler' => $extensionClassesPath . 'MVC/Web/AbstractRequestHandler.php',
+       'tx_extbase_mvc_web_backendrequesthandler' => $extensionClassesPath . 'MVC/Web/BackendRequestHandler.php',
+       'tx_extbase_mvc_web_frontendrequesthandler' => $extensionClassesPath . 'MVC/Web/FrontendRequestHandler.php',
        'tx_extbase_mvc_web_request' => $extensionClassesPath . 'MVC/Web/Request.php',
        'tx_extbase_mvc_web_requestbuilder' => $extensionClassesPath . 'MVC/Web/RequestBuilder.php',
        'tx_extbase_mvc_web_response' => $extensionClassesPath . 'MVC/Web/Response.php',
@@ -71,18 +78,23 @@ return array(
        'tx_extbase_object_exception' => $extensionClassesPath . 'Object/Exception.php',
        'tx_extbase_object_objectmanager' => $extensionClassesPath . 'Object/ObjectManager.php',
        'tx_extbase_object_objectmanagerinterface' => $extensionClassesPath . 'Object/ObjectManagerInterface.php',
+       'tx_extbase_object_container_classinfo' => $extensionClassesPath . 'Object/Container/ClassInfo.php',
+       'tx_extbase_object_container_classinfocache' => $extensionClassesPath . 'Object/Container/ClassInfoCache.php',
+       'tx_extbase_object_container_classinfofactory' => $extensionClassesPath . 'Object/Container/ClassInfoFactory.php',
+       'tx_extbase_object_container_container' => $extensionClassesPath . 'Object/Container/Container.php',
+       'tx_extbase_object_container_exception_cannotinitializecacheexception' => $extensionClassesPath . 'Object/Container/Exception/CannotInitializeCacheException.php',
+       'tx_extbase_object_container_exception_toomanyrecursionlevelsexception' => $extensionClassesPath . 'Object/Container/Exception/TooManyRecursionLevelsException.php',
+       'tx_extbase_object_container_exception_unknownobjectexception' => $extensionClassesPath . 'Object/Container/Exception/UnknownObjectException.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',
        'tx_extbase_object_objectalreadyregistered' => $extensionClassesPath . 'Object/Exception/ObjectAlreadyRegistered.php',
        'tx_extbase_object_unknownclass' => $extensionClassesPath . 'Object/Exception/UnknownClass.php',
        'tx_extbase_object_unknowninterface' => $extensionClassesPath . 'Object/Exception/UnknownInterface.php',
-       'tx_extbase_object_unknownobject' => $extensionClassesPath . 'Object/Exception/UnknownObject.php',
        'tx_extbase_object_unresolveddependencies' => $extensionClassesPath . 'Object/Exception/UnresolvedDependencies.php',
-       'tx_extbase_object_wrongscope' => $extensionClassesPath . 'Object/Exception/WrongScope.php',
+       'tx_extbase_object_exception_wrongscope' => $extensionClassesPath . 'Object/Exception/WrongScope.php',
        'tx_extbase_persistence_backend' => $extensionClassesPath . 'Persistence/Backend.php',
        'tx_extbase_persistence_backendinterface' => $extensionClassesPath . 'Persistence/BackendInterface.php',
        'tx_extbase_persistence_exception' => $extensionClassesPath . 'Persistence/Exception.php',
@@ -90,24 +102,26 @@ return array(
        'tx_extbase_persistence_lazyloadingproxy' => $extensionClassesPath . 'Persistence/LazyLoadingProxy.php',
        'tx_extbase_persistence_lazyobjectstorage' => $extensionClassesPath . 'Persistence/LazyObjectStorage.php',
        'tx_extbase_persistence_loadingstrategyinterface' => $extensionClassesPath . 'Persistence/LoadingStrategyInterface.php',
-       'tx_extbase_persistence_objectmonitoringinterface' => $extensionClassesPath . 'Persistence/ObjectMonitoringInterface.php',
        'tx_extbase_persistence_manager' => $extensionClassesPath . 'Persistence/Manager.php',
        'tx_extbase_persistence_managerinterface' => $extensionClassesPath . 'Persistence/ManagerInterface.php',
+       'tx_extbase_persistence_objectmonitoringinterface' => $extensionClassesPath . 'Persistence/ObjectMonitoringInterface.php',
        'tx_extbase_persistence_objectstorage' => $extensionClassesPath . 'Persistence/ObjectStorage.php',
        'tx_extbase_persistence_propertytype' => $extensionClassesPath . 'Persistence/PropertyType.php',
        'tx_extbase_persistence_query' => $extensionClassesPath . 'Persistence/Query.php',
        'tx_extbase_persistence_queryfactory' => $extensionClassesPath . 'Persistence/QueryFactory.php',
        'tx_extbase_persistence_queryfactoryinterface' => $extensionClassesPath . 'Persistence/QueryFactoryInterface.php',
        'tx_extbase_persistence_queryinterface' => $extensionClassesPath . 'Persistence/QueryInterface.php',
+       'tx_extbase_persistence_queryresult' => $extensionClassesPath . 'Persistence/QueryResult.php',
+       'tx_extbase_persistence_queryresultinterface' => $extensionClassesPath . 'Persistence/QueryResultInterface.php',
        'tx_extbase_persistence_querysettingsinterface' => $extensionClassesPath . 'Persistence/QuerySettingsInterface.php',
        'tx_extbase_persistence_repository' => $extensionClassesPath . 'Persistence/Repository.php',
        'tx_extbase_persistence_repositoryinterface' => $extensionClassesPath . 'Persistence/RepositoryInterface.php',
        'tx_extbase_persistence_session' => $extensionClassesPath . 'Persistence/Session.php',
        'tx_extbase_persistence_typo3querysettings' => $extensionClassesPath . 'Persistence/Typo3QuerySettings.php',
-       'tx_extbase_persistence_typo3querysettingsinterface' => $extensionClassesPath . 'Persistence/Typo3QuerySettingsInterface.php',
        'tx_extbase_persistence_exception_cleanstatenotmemorized' => $extensionClassesPath . 'Persistence/Exception/CleanStateNotMemorized.php',
        'tx_extbase_persistence_exception_illegalobjecttype' => $extensionClassesPath . 'Persistence/Exception/IllegalObjectType.php',
        'tx_extbase_persistence_exception_invalidclass' => $extensionClassesPath . 'Persistence/Exception/InvalidClass.php',
+       'tx_extbase_persistence_exception_invalidnumberofconstraints' => $extensionClassesPath . 'Persistence/Exception/InvalidNumberOfConstraints.php',
        'tx_extbase_persistence_exception_invalidpropertytype' => $extensionClassesPath . 'Persistence/Exception/InvalidPropertyType.php',
        'tx_extbase_persistence_exception_missingbackend' => $extensionClassesPath . 'Persistence/Exception/MissingBackend.php',
        'tx_extbase_persistence_exception_repositoryexception' => $extensionClassesPath . 'Persistence/Exception/RepositoryException.php',
@@ -116,16 +130,17 @@ return array(
        'tx_extbase_persistence_exception_unknownobject' => $extensionClassesPath . 'Persistence/Exception/UnknownObject.php',
        'tx_extbase_persistence_exception_unsupportedmethod' => $extensionClassesPath . 'Persistence/Exception/UnsupportedMethod.php',
        'tx_extbase_persistence_exception_unsupportedorder' => $extensionClassesPath . 'Persistence/Exception/UnsupportedOrder.php',
-       'tx_extbase_persistence_exception_valueformatexception' => $extensionClassesPath . 'Persistence/Exception/ValueFormatException.php',
+       'tx_extbase_persistence_exception_unsupportedrelation' => $extensionClassesPath . 'Persistence/Exception/UnsupportedRelation.php',
        'tx_extbase_persistence_mapper_columnmap' => $extensionClassesPath . 'Persistence/Mapper/ColumnMap.php',
        'tx_extbase_persistence_mapper_datamap' => $extensionClassesPath . 'Persistence/Mapper/DataMap.php',
-       'tx_extbase_persistence_mapper_datamapper' => $extensionClassesPath . 'Persistence/Mapper/DataMapper.php',
        'tx_extbase_persistence_mapper_datamapfactory' => $extensionClassesPath . 'Persistence/Mapper/DataMapFactory.php',
+       'tx_extbase_persistence_mapper_datamapper' => $extensionClassesPath . 'Persistence/Mapper/DataMapper.php',
        'tx_extbase_persistence_qom_andinterface' => $extensionClassesPath . 'Persistence/QOM/AndInterface.php',
        'tx_extbase_persistence_qom_bindvariablevalue' => $extensionClassesPath . 'Persistence/QOM/BindVariableValue.php',
        'tx_extbase_persistence_qom_bindvariablevalueinterface' => $extensionClassesPath . 'Persistence/QOM/BindVariableValueInterface.php',
        'tx_extbase_persistence_qom_comparison' => $extensionClassesPath . 'Persistence/QOM/Comparison.php',
        'tx_extbase_persistence_qom_comparisoninterface' => $extensionClassesPath . 'Persistence/QOM/ComparisonInterface.php',
+       'tx_extbase_persistence_qom_constraint' => $extensionClassesPath . 'Persistence/QOM/Constraint.php',
        'tx_extbase_persistence_qom_constraintinterface' => $extensionClassesPath . 'Persistence/QOM/ConstraintInterface.php',
        'tx_extbase_persistence_qom_dynamicoperand' => $extensionClassesPath . 'Persistence/QOM/DynamicOperand.php',
        'tx_extbase_persistence_qom_dynamicoperandinterface' => $extensionClassesPath . 'Persistence/QOM/DynamicOperandInterface.php',
@@ -147,16 +162,13 @@ return array(
        'tx_extbase_persistence_qom_orderinginterface' => $extensionClassesPath . 'Persistence/QOM/OrderingInterface.php',
        'tx_extbase_persistence_qom_propertyvalue' => $extensionClassesPath . 'Persistence/QOM/PropertyValue.php',
        'tx_extbase_persistence_qom_propertyvalueinterface' => $extensionClassesPath . 'Persistence/QOM/PropertyValueInterface.php',
-       'tx_extbase_persistence_qom_queryobjectmodel' => $extensionClassesPath . 'Persistence/QOM/QueryObjectModel.php',
        'tx_extbase_persistence_qom_queryobjectmodelconstantsinterface' => $extensionClassesPath . 'Persistence/QOM/QueryObjectModelConstantsInterface.php',
        'tx_extbase_persistence_qom_queryobjectmodelfactory' => $extensionClassesPath . 'Persistence/QOM/QueryObjectModelFactory.php',
        'tx_extbase_persistence_qom_queryobjectmodelfactoryinterface' => $extensionClassesPath . 'Persistence/QOM/QueryObjectModelFactoryInterface.php',
-       'tx_extbase_persistence_qom_queryobjectmodelinterface' => $extensionClassesPath . 'Persistence/QOM/QueryObjectModelInterface.php',
        'tx_extbase_persistence_qom_selector' => $extensionClassesPath . 'Persistence/QOM/Selector.php',
        'tx_extbase_persistence_qom_selectorinterface' => $extensionClassesPath . 'Persistence/QOM/SelectorInterface.php',
        'tx_extbase_persistence_qom_sourceinterface' => $extensionClassesPath . 'Persistence/QOM/SourceInterface.php',
        'tx_extbase_persistence_qom_statement' => $extensionClassesPath . 'Persistence/QOM/Statement.php',
-       'tx_extbase_persistence_qom_statementinterface' => $extensionClassesPath . 'Persistence/QOM/StatementInterface.php',
        'tx_extbase_persistence_qom_staticoperand' => $extensionClassesPath . 'Persistence/QOM/StaticOperand.php',
        'tx_extbase_persistence_qom_staticoperandinterface' => $extensionClassesPath . 'Persistence/QOM/StaticOperandInterface.php',
        'tx_extbase_persistence_qom_uppercase' => $extensionClassesPath . 'Persistence/QOM/UpperCase.php',
@@ -192,8 +204,8 @@ return array(
        'tx_extbase_utility_extbaserequirementscheck' => $extensionClassesPath . 'Utility/ExtbaseRequirementsCheck.php',
        'tx_extbase_utility_extension' => $extensionClassesPath . 'Utility/Extension.php',
        'tx_extbase_utility_localization' => $extensionClassesPath . 'Utility/Localization.php',
-       'tx_extbase_utility_typoscript' => $extensionClassesPath . 'Utility/TypoScript.php',
        'tx_extbase_utility_typehandling' => $extensionClassesPath . 'Utility/TypeHandling.php',
+       'tx_extbase_utility_typoscript' => $extensionClassesPath . 'Utility/TypoScript.php',
        'tx_extbase_validation_error' => $extensionClassesPath . 'Validation/Error.php',
        'tx_extbase_validation_exception' => $extensionClassesPath . 'Validation/Exception.php',
        'tx_extbase_validation_propertyerror' => $extensionClassesPath . 'Validation/PropertyError.php',
@@ -224,5 +236,6 @@ return array(
        'tx_extbase_validation_validator_stringvalidator' => $extensionClassesPath . 'Validation/Validator/StringValidator.php',
        'tx_extbase_validation_validator_textvalidator' => $extensionClassesPath . 'Validation/Validator/TextValidator.php',
        'tx_extbase_validation_validator_validatorinterface' => $extensionClassesPath . 'Validation/Validator/ValidatorInterface.php',
+       'tx_extbase_basetestcase' => $extensionClassesPath . '../Tests/BaseTestCase.php',
 );
 ?>
\ No newline at end of file
index dbba11e..82f7fc8 100644 (file)
@@ -33,8 +33,7 @@ $EM_CONF[$_EXTKEY] = array(
        'constraints' => array(
                'depends' => array(
                        'php' => '5.2.0-0.0.0',
-                       'typo3' => '4.4.0-0.0.0',
-                       'container' => '0.0.1-0.0.0'
+                       'typo3' => '4.4.0-0.0.0'
                ),
                'conflicts' => array(
                ),
index ba41b73..33ad7fc 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 if (!defined ('TYPO3_MODE')) die ('Access denied.');
 
-
 if (TYPO3_MODE == 'BE') {
 
        // register the cache in BE so it will be cleared with "clear all caches"
@@ -17,7 +16,7 @@ if (TYPO3_MODE == 'BE') {
 
        }
 
-       $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Dispatcher';
+       $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Bootstrap->callModule';
        
 }
 
index a3db992..ab7de87 100644 (file)
@@ -1,4 +1,10 @@
 config.tx_extbase {
+       mvc {
+               requestHandlers {
+                       Tx_Extbase_MVC_Web_FrontendRequestHandler = Tx_Extbase_MVC_Web_FrontendRequestHandler
+                       Tx_Extbase_MVC_Web_BackendRequestHandler = Tx_Extbase_MVC_Web_BackendRequestHandler
+               }
+       }
        persistence{
                enableAutomaticCacheClearing = 1
                updateReferenceIndex = 0