* @subpackage Configuration
* @version $ID:$
*/
-abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
+abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements t3lib_Singleton {
/**
* Default backend storage PID
*/
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
*
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');
}
$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;
}
*
* @return array the TypoScript setup
*/
- abstract public function loadTypoScriptSetup();
+ abstract protected function getTypoScriptSetup();
/**
* Resolves the TypoScript reference for $pluginConfiguration[$setting].
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]);
* @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
/**
* 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
--- /dev/null
+<?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
--- /dev/null
+<?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
*/
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;
}
* @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');
return $frameworkConfiguration;
}
}
-?>
+?>
\ No newline at end of file
--- /dev/null
+<?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
***************************************************************/
/**
- * 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);
}
}
* @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
*/
*/
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;
}
/**
* @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;
}
* @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;
$this->response->setHeader('Location', (string)$uri);
throw new Tx_Extbase_MVC_Exception_StopAction();
}
-
+
/**
* Adds the base uri if not already in place.
*
* @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);
}
* @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;
}
$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')) {
&& 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;
}
/**
* @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;
* 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
*/
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.
*
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();
--- /dev/null
+<?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
*
* @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]
*/
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.
*/
*/
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);
return $objectName;
}
+ /**
+ * 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.
*
return Tx_Extbase_Utility_Extension::convertCamelCaseToLowerCaseUnderscored($this->controllerExtensionName);
}
+ /**
+ * 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!
--- /dev/null
+<?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
--- /dev/null
+<?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
* 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
*/
* @scope prototype
* @api
*/
-class Tx_Extbase_MVC_Response {
+class Tx_Extbase_MVC_Response implements Tx_Extbase_MVC_ResponseInterface {
/**
* @var string The response content
return $this->content;
}
+ /**
+ * Returns the content of the response.
+ *
+ * @return string
+ * @api
+ */
+ public function __toString() {
+ return $this->getContent();
+ }
+
}
?>
\ No newline at end of file
* 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 {
*/
public function getContent();
- /**
- * Sends the response
- *
- * @return void
- * @api
- */
- public function send();
}
?>
\ No newline at end of file
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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
*
* @scope prototype
*/
-class Tx_Extbase_MVC_Web_RequestBuilder {
+class Tx_Extbase_MVC_Web_RequestBuilder implements t3lib_Singleton {
/**
* @var Tx_Extbase_Object_ObjectManagerInterface
*/
*/
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'];
}
}
$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
* @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)) {
*/
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');
}
return $this->argumentsToBeExcludedFromQueryString;
}
+ /**
+ * 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
*
$this->targetPageType = 0;
$this->noCache = FALSE;
$this->useCacheHash = TRUE;
+ $this->argumentPrefix = NULL;
return $this;
}
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();
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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 {
+}
+?>
--- /dev/null
+<?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 {
+}
+?>
--- /dev/null
+<?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
+++ /dev/null
-<?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
class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManagerInterface {
/**
- * @var Tx_Container_Container
+ * @var Tx_Extbase_Object_Container_Container
*/
protected $objectContainer;
* Constructs a new Object Manager
*/
public function __construct() {
- $this->objectContainer = Tx_Container_Container::getContainer();
+ $this->objectContainer = Tx_Extbase_Object_Container_Container::getContainer();
}
/**
* @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);
}
}
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');
}
}
$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);
$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;
);
}
$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());
}
}
* @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];
}
* @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
*
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
$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'];
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
// debug($dataMap);
return $dataMap;
}
-
+
/**
* Returns the TCA ctrl section of the specified table; or NULL if not set
*
$this->includeTca($tableName);
return is_array($GLOBALS['TCA'][$tableName]['ctrl']) ? $GLOBALS['TCA'][$tableName]['ctrl'] : NULL;
}
-
+
/**
* Returns the TCA columns array of the specified table
*
$this->includeTca($tableName);
return is_array($GLOBALS['TCA'][$tableName]['columns']) ? $GLOBALS['TCA'][$tableName]['columns'] : array();
}
-
+
/**
* Includes the TCA for the given table
*
}
t3lib_div::loadTCA($tableName);
}
-
+
protected function addMetaDataColumnNames(Tx_Extbase_Persistence_Mapper_DataMap $dataMap, $tableName) {
$controlSection = $GLOBALS['TCA'][$tableName]['ctrl'];
$dataMap->setPageIdColumnName('pid');
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
}
return $columnMap;
}
-
+
/**
* This method sets the configuration for a 1:1 relation based on
* the $TCA column configuration
$columnMap->setParentTableFieldName($columnConfiguration['foreign_table_field']);
return $columnMap;
}
-
+
/**
* This method sets the configuration for a 1:n relation based on
* the $TCA column configuration
$columnMap->setParentTableFieldName($columnConfiguration['foreign_table_field']);
return $columnMap;
}
-
+
/**
* This method sets the configuration for a m:n relation based on
* the $TCA column configuration
}
return $columnMap;
}
-
+
}
\ No newline at end of file
--- /dev/null
+<?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
);
}
+ /**
+ * @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
$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
$result = $this->createQuery()->execute();
return $result;
}
-
+
/**
* Returns the total number objects of this repository.
*
public function countAll() {
return $this->createQuery()->count();
}
-
+
/**
* Removes all objects of this repository as if remove() was called for
* all of them.
const OPERATOR_EQUAL_TO_NULL = 'operatorEqualToNull';
const OPERATOR_NOT_EQUAL_TO_NULL = 'operatorNotEqualToNull';
-
+
/**
* The TYPO3 database object
*
*/
protected $tableInformationCache = array();
+ /**
+ * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
+ */
+ protected $configurationManager;
+
/**
* Constructor. takes the database handle from $GLOBALS['TYPO3_DB']
*/
$this->databaseHandle = $GLOBALS['TYPO3_DB'];
}
+ /**
+ * @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
*
return FALSE;
}
}
-
+
protected function parseIdentifier(array $identifier) {
$fieldNames = array_keys($identifier);
$suffixedFieldNames = array();
}
return implode(' AND ', $suffixedFieldNames);
}
-
+
/**
* Returns the object data matching the $query.
*
$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);
$rows = $this->getRowsFromResult($query->getSource(), $result);
return current(current($rows));
}
-
+
/**
* Parses the query and returns the SQL statement parts.
*
$sql['limit'] = array();
$source = $query->getSource();
-
+
$this->parseSource($source, $sql, $parameters);
$this->parseConstraint($query->getConstraint(), $source, $sql, $parameters);
$this->parseOrderings($query->getOrderings(), $source, $sql);
return $sql;
}
-
+
/**
* Returns the statement, ready to be executed.
*
$tableName = $dataMap->getTableName();
$this->addEnableFieldsStatement($tableName, $sql);
-
+
$statement = 'SELECT * FROM ' . $tableName;
$statement .= ' WHERE ' . implode(' AND ', $fields);
if (!empty($sql['additionalWhereClause'])) {
$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.
*
$sql['fields'][$leftTableName] = $rightTableName . '.*';
}
$this->addRecordTypeConstraint($rightClassName, $sql);
-
+
$sql['tables'][$leftTableName] = $leftTableName;
$sql['unions'][$rightTableName] = 'LEFT JOIN ' . $rightTableName;
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) {
// 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;
$parameters[] = $this->getPlainValue($operand2);
}
}
-
+
/**
* Returns a plain value, i.e. objects are flattened out if possible.
*
$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];
}
}
}
-
+
/**
* Builds the language field statement
*
}
}
}
-
+
/**
* Builds the page ID checking statement
*
$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'])) . ')';
}
}
}
}
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.
* @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;
}
}
- // 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);
}
}
* @version $Id$
* @api
*/
+// FIXME This class should be a Prototype
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.
*
* @var boolean
*/
- protected $cacheNeedsUpdate = FALSE;
+ protected $dataCacheNeedsUpdate = FALSE;
/**
* Local cache for Class schemata
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;
}
/**
* @return void
*/
public function shutdown() {
- if ($this->cacheNeedsUpdate) {
+ if ($this->dataCacheNeedsUpdate) {
$this->saveToCache();
}
}
}
ksort($this->reflectedClassNames);
- $this->cacheNeedsUpdate = TRUE;
+ $this->dataCacheNeedsUpdate = TRUE;
}
/**
}
}
$this->classSchemata[$className] = $classSchema;
- $this->cacheNeedsUpdate = TRUE;
+ $this->dataCacheNeedsUpdate = TRUE;
return $classSchema;
}
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];
}
* @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;
}
* @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
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
$reports = array(
'docCommentsShouldBePreserved' => $this->checkIfDocCommentsArePreserved()
);
-
+
return $reports;
}
*/
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';
$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 .
}
if ((strlen($sub) > 0)) {
- $sub = $extensionName . self::convertLowerUnderscoreToUpperCamelCase($sub);
+ //$sub = $extensionName . self::convertLowerUnderscoreToUpperCamelCase($sub);
$key = $main . '_' . $sub;
} else {
$key = $main;
*
* @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;
}
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>';
}
* @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);
* @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);
* @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;
}
/**
- * 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;
}
* 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;
}
* @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 {
* @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;
}
/**
* @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().');
}
/**
* @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'));
}
/**
+++ /dev/null
-<?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
$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');
$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));
$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);
$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);
* @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!');
}
* @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.');
* @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.');
* @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();
}
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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);
+ }
+
+
+
+}
+
+
+?>
--- /dev/null
+<?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;
+ }
+}
+
+
* 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
*
* @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 . '"');
}
* @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);
* @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'));
}
* @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);
* @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'));
* @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"'));
* @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"'));
$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);
$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);
<?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',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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
'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(
),
<?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"
}
- $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Dispatcher';
+ $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Bootstrap->callModule';
}
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