* prepared the Persistence Repository
authorJochen Rau <j.rau@web.de>
Fri, 23 Jan 2009 23:40:51 +0000 (23:40 +0000)
committerJochen Rau <j.rau@web.de>
Fri, 23 Jan 2009 23:40:51 +0000 (23:40 +0000)
* rewritten the Persistence Session
* added an Object Storage based on SplObjectStorage
* several renamings and clean-ups

39 files changed:
typo3/sysext/extbase/Classes/Configuration/Exception/TX_EXTMVC_Configuration_Exception_ContainerIsLocked.php
typo3/sysext/extbase/Classes/Configuration/Exception/TX_EXTMVC_Configuration_Exception_InvalidConfigurationType.php
typo3/sysext/extbase/Classes/Configuration/Exception/TX_EXTMVC_Configuration_Exception_NoSuchFile.php
typo3/sysext/extbase/Classes/Configuration/Exception/TX_EXTMVC_Configuration_Exception_NoSuchOption.php
typo3/sysext/extbase/Classes/Configuration/Exception/TX_EXTMVC_Configuration_Exception_ParseError.php
typo3/sysext/extbase/Classes/Configuration/Source/TX_EXTMVC_Configuration_Source_PHP.php
typo3/sysext/extbase/Classes/Configuration/Source/TX_EXTMVC_Configuration_Source_YAML.php
typo3/sysext/extbase/Classes/Configuration/TX_EXTMVC_Configuration_Container.php
typo3/sysext/extbase/Classes/Configuration/TX_EXTMVC_Configuration_Manager.php
typo3/sysext/extbase/Classes/Configuration/TX_EXTMVC_Configuration_SourceInterface.php
typo3/sysext/extbase/Classes/Controller/TX_EXTMVC_Controller_AbstractController.php
typo3/sysext/extbase/Classes/Controller/TX_EXTMVC_Controller_Arguments.php
typo3/sysext/extbase/Classes/Controller/TX_EXTMVC_Controller_ArgumentsValidator.php
typo3/sysext/extbase/Classes/Controller/TX_EXTMVC_Controller_DefaultController.php
typo3/sysext/extbase/Classes/Controller/TX_EXTMVC_Controller_RequestHandlingController.php
typo3/sysext/extbase/Classes/Persistence/Exception/TX_EXTMVC_Persistence_Exception_InvalidClass.php
typo3/sysext/extbase/Classes/Persistence/Exception/TX_EXTMVC_Persistence_Exception_InvalidPropertyType.php
typo3/sysext/extbase/Classes/Persistence/Exception/TX_EXTMVC_Persistence_Exception_MissingBackend.php
typo3/sysext/extbase/Classes/Persistence/Exception/TX_EXTMVC_Persistence_Exception_TooDirty.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_BackendInterface.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_ClassSchema.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_ClassSchemataBuilder.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_Exception.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_Manager.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_ManagerInterface.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_ObjectStorage.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_QueryFactoryInterface.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_QueryInterface.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_Repository.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_RepositoryInterface.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_Session.php
typo3/sysext/extbase/Classes/TX_EXTMVC_DefaultRequestHandler.php
typo3/sysext/extbase/Classes/TX_EXTMVC_Request.php
typo3/sysext/extbase/Classes/TX_EXTMVC_RequestProcessorChainManager.php
typo3/sysext/extbase/Classes/View/Helper/TX_EXTMVC_View_Helper_URIHelper.php
typo3/sysext/extbase/Classes/View/TX_EXTMVC_View_DefaultView.php
typo3/sysext/extbase/Classes/Web/TX_EXTMVC_Web_RequestBuilder.php
typo3/sysext/extbase/Classes/Web/TX_EXTMVC_Web_RequestHandler.php
typo3/sysext/extbase/class.tx_extmvc_dispatcher.php

index f7d2684..62469b9 100644 (file)
@@ -31,7 +31,7 @@ declare(ENCODING = 'utf-8');
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class ContainerIsLocked extends F3_FLOW3_Configuration_Exception {
+class ContainerIsLocked extends TX_EXTMVC_Configuration_Exception {
 
 }
 
index 530b366..1e96aa4 100644 (file)
@@ -31,7 +31,7 @@ declare(ENCODING = 'utf-8');
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class InvalidConfigurationType extends F3_FLOW3_Configuration_Exception {
+class InvalidConfigurationType extends TX_EXTMVC_Configuration_Exception {
 
 }
 
index 87bb22c..c9432aa 100644 (file)
@@ -31,7 +31,7 @@ declare(ENCODING = 'utf-8');
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class NoSuchFile extends F3_FLOW3_Configuration_Exception {
+class NoSuchFile extends TX_EXTMVC_Configuration_Exception {
 
 }
 
index 1eca3f3..6c6a741 100644 (file)
@@ -31,7 +31,7 @@ declare(ENCODING = 'utf-8');
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class NoSuchOption extends F3_FLOW3_Configuration_Exception {
+class NoSuchOption extends TX_EXTMVC_Configuration_Exception {
 
 }
 
index 2908fab..5f22be5 100644 (file)
@@ -31,7 +31,7 @@ declare(ENCODING = 'utf-8');
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class ParseError extends F3_FLOW3_Configuration_Exception {
+class ParseError extends TX_EXTMVC_Configuration_Exception {
 
 }
 
index b34e538..afe2be0 100644 (file)
@@ -27,7 +27,7 @@ declare(ENCODING = 'utf-8');
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class PHP implements F3_FLOW3_Configuration_SourceInterface {
+class PHP implements TX_EXTMVC_Configuration_SourceInterface {
 
        /**
         * Loads the specified configuration file and returns its content as an
@@ -39,7 +39,7 @@ class PHP implements F3_FLOW3_Configuration_SourceInterface {
         * @author Robert Lemke <robert@typo3.org>
         */
        public function load($pathAndFilename) {
-               $c = new F3_FLOW3_Configuration_Container();
+               $c = new TX_EXTMVC_Configuration_Container();
                if (file_exists($pathAndFilename . '.php')) {
                        require ($pathAndFilename . '.php');
                }
index bf4197a..0eec3ac 100644 (file)
@@ -27,7 +27,7 @@ declare(ENCODING = 'utf-8');
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class YAML implements F3_FLOW3_Configuration_SourceInterface {
+class YAML implements TX_EXTMVC_Configuration_SourceInterface {
 
        /**
         * Loads the specified configuration file and returns its content as an
@@ -42,8 +42,8 @@ class YAML implements F3_FLOW3_Configuration_SourceInterface {
                if (file_exists($pathAndFilename . '.yaml')) {
                        try {
                                $configuration = F3_YAML_YAML::loadFile($pathAndFilename . '.yaml');
-                       } catch (_F3_FLOW3_Error_Exception $exception) {
-                               throw new F3_FLOW3_Configuration_Exception_ParseError('A parse error occurred while parsing file "' . $pathAndFilename . '.yaml". Error message: ' . $exception->getMessage(), 1232014321);
+                       } catch (F3_FLOW3_Error_Exception $exception) {
+                               throw new TX_EXTMVC_Configuration_Exception_ParseError('A parse error occurred while parsing file "' . $pathAndFilename . '.yaml". Error message: ' . $exception->getMessage(), 1232014321);
                        }
                } else {
                        $configuration = array();
index 14fb281..b1fefcb 100644 (file)
@@ -88,7 +88,7 @@ class Container implements Countable, Iterator, ArrayAccess {
        public function getAsArray() {
                $optionsArray = array();
                foreach ($this->options as $key => $value) {
-                       $optionsArray[$key] = ($value instanceof F3_FLOW3_Configuration_Container) ? $value->getAsArray() : $value;
+                       $optionsArray[$key] = ($value instanceof TX_EXTMVC_Configuration_Container) ? $value->getAsArray() : $value;
                }
                return $optionsArray;
        }
@@ -102,7 +102,7 @@ class Container implements Countable, Iterator, ArrayAccess {
        public function lock() {
                $this->locked = TRUE;
                foreach ($this->options as $option) {
-                       if ($option instanceof F3_FLOW3_Configuration_Container) {
+                       if ($option instanceof TX_EXTMVC_Configuration_Container) {
                                $option->lock();
                        }
                }
@@ -121,15 +121,15 @@ class Container implements Countable, Iterator, ArrayAccess {
        /**
         * Merges this container with another configuration container
         *
-        * @param F3_FLOW3_Configuration_Container $otherConfiguration The other configuration container
-        * @return F3_FLOW3_Configuration_Container This container
+        * @param TX_EXTMVC_Configuration_Container $otherConfiguration The other configuration container
+        * @return TX_EXTMVC_Configuration_Container This container
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function mergeWith(_F3_FLOW3_Configuration_Container $otherConfiguration) {
+       public function mergeWith(TX_EXTMVC_Configuration_Container $otherConfiguration) {
                foreach ($otherConfiguration as $optionName => $newOptionValue) {
-                       if ($newOptionValue instanceof F3_FLOW3_Configuration_Container && array_key_exists($optionName, $this->options)) {
+                       if ($newOptionValue instanceof TX_EXTMVC_Configuration_Container && array_key_exists($optionName, $this->options)) {
                                $existingOptionValue = $this->__get($optionName);
-                               if ($existingOptionValue instanceof F3_FLOW3_Configuration_Container) {
+                               if ($existingOptionValue instanceof TX_EXTMVC_Configuration_Container) {
                                        $newOptionValue = $existingOptionValue->mergeWith($newOptionValue);
                                }
                        }
@@ -255,7 +255,7 @@ class Container implements Countable, Iterator, ArrayAccess {
         */
        public function __get($optionName) {
                if (!array_key_exists($optionName, $this->options)) {
-                       if ($this->locked) throw new F3_FLOW3_Configuration_Exception_NoSuchOption('An option "' . $optionName . '" does not exist in this configuration container.', 1216385011);
+                       if ($this->locked) throw new TX_EXTMVC_Configuration_Exception_NoSuchOption('An option "' . $optionName . '" does not exist in this configuration container.', 1216385011);
                        $this->__set($optionName, new self());
                }
                return $this->options[$optionName];
@@ -267,11 +267,11 @@ class Container implements Countable, Iterator, ArrayAccess {
         * @param string $optionName Name of the configuration option to set
         * @param mixed $optionValue The option value
         * @return void
-        * @throws F3_FLOW3_Configuration_Exception_ContainerIsLocked if the container is locked
+        * @throws TX_EXTMVC_Configuration_Exception_ContainerIsLocked if the container is locked
         * @author Robert Lemke <robert@typo3.org>
         */
        public function __set($optionName, $optionValue) {
-               if ($this->locked && !array_key_exists($optionName, $this->options)) throw new F3_FLOW3_Configuration_Exception_ContainerIsLocked('You tried to create a new configuration option "' . $optionName . '" but the configuration container is already locked. Maybe a spelling mistake?', 1206023011);
+               if ($this->locked && !array_key_exists($optionName, $this->options)) throw new TX_EXTMVC_Configuration_Exception_ContainerIsLocked('You tried to create a new configuration option "' . $optionName . '" but the configuration container is already locked. Maybe a spelling mistake?', 1206023011);
                $this->options[$optionName] = $optionValue;
                $this->iteratorCount = count($this->options);
        }
@@ -292,11 +292,11 @@ class Container implements Countable, Iterator, ArrayAccess {
         *
         * @param string $optionName Name of the configuration option to unset
         * @return void
-        * @throws F3_FLOW3_Configuration_Exception_ContainerIsLocked if the container is locked
+        * @throws TX_EXTMVC_Configuration_Exception_ContainerIsLocked if the container is locked
         * @author Robert Lemke <robert@typo3.org>
         */
        public function __unset($optionName) {
-               if ($this->locked) throw new F3_FLOW3_Configuration_Exception_ContainerIsLocked('You tried to unset the configuration option "' . $optionName . '" but the configuration container is locked.', 1206023012);
+               if ($this->locked) throw new TX_EXTMVC_Configuration_Exception_ContainerIsLocked('You tried to unset the configuration option "' . $optionName . '" but the configuration container is locked.', 1206023012);
                unset($this->options[$optionName]);
                $this->iteratorCount = count($this->options);
        }
@@ -306,16 +306,16 @@ class Container implements Countable, Iterator, ArrayAccess {
         *
         * @param string $methodName Name of the called setter method.
         * @param array $arguments Method arguments, passed to the configuration option.
-        * @return F3_FLOW3_Configuration_Container This configuration container object
-        * @throws F3_FLOW3_Configuration_Exception if $methodName does not start with "set" or number of arguments are empty
+        * @return TX_EXTMVC_Configuration_Container This configuration container object
+        * @throws TX_EXTMVC_Configuration_Exception if $methodName does not start with "set" or number of arguments are empty
         * @author Bastian Waidelich <bastian@typo3.org>
         */
        public function __call($methodName, $arguments) {
                if (substr($methodName, 0, 3) != 'set') {
-                       throw new F3_FLOW3_Configuration_Exception('Method "' . $methodName . '" does not exist.', 1213444319);
+                       throw new TX_EXTMVC_Configuration_Exception('Method "' . $methodName . '" does not exist.', 1213444319);
                }
                if (count($arguments) != 1) {
-                       throw new F3_FLOW3_Configuration_Exception('You have to pass exactly one argument to a configuration option setter.', 1213444809);
+                       throw new TX_EXTMVC_Configuration_Exception('You have to pass exactly one argument to a configuration option setter.', 1213444809);
                }
                $optionName = lcfirst(substr($methodName, 3));
                $this->__set($optionName, $arguments[0]);
index 8d33ee8..78b4f39 100644 (file)
@@ -83,15 +83,15 @@ class Manager {
        }
 
        /**
-        * Returns an array with the settings defined for the specified package.
+        * Returns an array with the settings defined for the specified extension.
         *
-        * @param string $packageKey Key of the package to return the settings for
-        * @return array The settings of the specified package
+        * @param string $extensionKey Key of the extension to return the settings for
+        * @return array The settings of the specified extension
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function getSettings($packageKey) {
-               if (isset($this->settings[$packageKey])) {
-                       $settings = $this->settings[$packageKey];
+       public function getSettings($extensionKey) {
+               if (isset($this->settings[$extensionKey])) {
+                       $settings = $this->settings[$extensionKey];
                } else {
                        $settings = array();
                }
@@ -99,12 +99,12 @@ class Manager {
        }
 
        /**
-        * Loads the FLOW3 core settings defined in the FLOW3 package and the global
+        * Loads the FLOW3 core settings defined in the FLOW3 extension and the global
         * configuration directories.
         *
         * The FLOW3 settings can be retrieved like any other setting through the
         * getSettings() method but need to be loaded separately because they are
-        * needed way earlier in the bootstrap than the package's settings.
+        * needed way earlier in the bootstrap than the extension's settings.
         *
         * @return void
         * @internal
@@ -125,29 +125,29 @@ class Manager {
        }
 
        /**
-        * Loads the settings defined in the specified packages and merges them with
+        * Loads the settings defined in the specified extensions and merges them with
         * those potentially existing in the global configuration folders.
         *
         * The result is stored in the configuration manager's settings registry
         * and can be retrieved with the getSettings() method.
         *
-        * @param array $packageKeys
+        * @param array $extensionKeys
         * @return void
         * @see getSettings()
         * @internal
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function loadGlobalSettings(array $packageKeys) {
+       public function loadGlobalSettings(array $extensionKeys) {
                $settings = array();
-               sort ($packageKeys);
-               $index = array_search('FLOW3', $packageKeys);
+               sort ($extensionKeys);
+               $index = array_search('FLOW3', $extensionKeys);
                if ($index !== FALSE) {
-                       unset ($packageKeys[$index]);
-                       array_unshift($packageKeys, 'FLOW3');
+                       unset ($extensionKeys[$index]);
+                       array_unshift($extensionKeys, 'FLOW3');
                }
-               foreach ($packageKeys as $packageKey) {
+               foreach ($extensionKeys as $extensionKey) {
                        foreach ($this->configurationSources as $configurationSource) {
-                               $settings = F3_FLOW3_Utility_Arrays::arrayMergeRecursiveOverrule($settings, $configurationSource->load(FLOW3_PATH_PACKAGES . $packageKey . '/Configuration/Settings'));
+                               $settings = F3_FLOW3_Utility_Arrays::arrayMergeRecursiveOverrule($settings, $configurationSource->load(FLOW3_PATH_PACKAGES . $extensionKey . '/Configuration/Settings'));
                        }
                }
                foreach ($this->configurationSources as $configurationSource) {
@@ -159,7 +159,7 @@ class Manager {
        }
 
        /**
-        * Loads special configuration defined in the specified packages and merges them with
+        * Loads special configuration defined in the specified extensions and merges them with
         * those potentially existing in the global configuration folders.
         *
         * The result is stored in the configuration manager's configuration registry
@@ -168,21 +168,21 @@ class Manager {
         * parts of FLOW3
         *
         * @param string $configurationType The kind of configuration to load - must be one of the CONFIGURATION_TYPE_* constants
-        * @param array $packageKeys A list of packages to consider
+        * @param array $extensionKeys A list of extensions to consider
         * @return void
         * @internal
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function loadSpecialConfiguration($configurationType, array $packageKeys) {
-               $index = array_search('FLOW3', $packageKeys);
+       public function loadSpecialConfiguration($configurationType, array $extensionKeys) {
+               $index = array_search('FLOW3', $extensionKeys);
                if ($index !== FALSE) {
-                       unset ($packageKeys[$index]);
-                       array_unshift($packageKeys, 'FLOW3');
+                       unset ($extensionKeys[$index]);
+                       array_unshift($extensionKeys, 'FLOW3');
                }
 
-               foreach ($packageKeys as $packageKey) {
+               foreach ($extensionKeys as $extensionKey) {
                        foreach ($this->configurationSources as $configurationSource) {
-                               $this->configurations[$configurationType] = F3_FLOW3_Utility_Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $configurationSource->load(FLOW3_PATH_PACKAGES . $packageKey . '/Configuration/' . $configurationType));
+                               $this->configurations[$configurationType] = F3_FLOW3_Utility_Arrays::arrayMergeRecursiveOverrule($this->configurations[$configurationType], $configurationSource->load(FLOW3_PATH_PACKAGES . $extensionKey . '/Configuration/' . $configurationType));
                        }
                }
                foreach ($this->configurationSources as $configurationSource) {
@@ -202,13 +202,13 @@ class Manager {
         * by FLOW3 internally.
         *
         * @param string $configurationType The kind of configuration to fetch - must be one of the CONFIGURATION_TYPE_* constants
-        * @param string $packageKey Key of the package the configuration is for
+        * @param string $extensionKey Key of the extension the configuration is for
         * @return array The configuration
-        * @throws F3_FLOW3_Configuration_Exception_InvalidConfigurationType on invalid configuration types
+        * @throws TX_EXTMVC_Configuration_Exception_InvalidConfigurationType on invalid configuration types
         * @internal
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function getSpecialConfiguration($configurationType, $packageKey = 'FLOW3') {
+       public function getSpecialConfiguration($configurationType, $extensionKey = 'FLOW3') {
                switch ($configurationType) {
                        case self::CONFIGURATION_TYPE_ROUTES :
                        case self::CONFIGURATION_TYPE_SIGNALSSLOTS :
@@ -218,11 +218,11 @@ class Manager {
                        case self::CONFIGURATION_TYPE_OBJECTS :
                        break;
                        default:
-                               throw new F3_FLOW3_Configuration_Exception_InvalidConfigurationType('Invalid configuration type "' . $configurationType . '"', 1206031879);
+                               throw new TX_EXTMVC_Configuration_Exception_InvalidConfigurationType('Invalid configuration type "' . $configurationType . '"', 1206031879);
                }
                $configuration = array();
                foreach ($this->configurationSources as $configurationSource) {
-                       $configuration = F3_FLOW3_Utility_Arrays::arrayMergeRecursiveOverrule($configuration, $configurationSource->load(FLOW3_PATH_PACKAGES . $packageKey . '/Configuration/' . $configurationType));
+                       $configuration = F3_FLOW3_Utility_Arrays::arrayMergeRecursiveOverrule($configuration, $configurationSource->load(FLOW3_PATH_PACKAGES . $extensionKey . '/Configuration/' . $configurationType));
                }
                foreach ($this->configurationSources as $configurationSource) {
                        $configuration = F3_FLOW3_Utility_Arrays::arrayMergeRecursiveOverrule($configuration, $configurationSource->load(FLOW3_PATH_CONFIGURATION . $configurationType));
@@ -233,7 +233,7 @@ class Manager {
 
                switch ($configurationType) {
                        case self::CONFIGURATION_TYPE_PACKAGES :
-                               return (isset($configuration[$packageKey])) ? $configuration[$packageKey] : array();
+                               return (isset($configuration[$extensionKey])) ? $configuration[$extensionKey] : array();
                        case self::CONFIGURATION_TYPE_OBJECTS :
                                return $configuration;
                }
index aa1f1cd..825ea4b 100644 (file)
@@ -35,8 +35,8 @@ interface SourceInterface {
         * configuration container
         *
         * @param string $pathAndFilename Full path and file name of the file to load, excluding the dot and file extension
-        * @return F3_FLOW3_Configuration_Container
-        * @throws F3_FLOW3_Configuration_Exception_NoSuchFile if the specified file does not exist
+        * @return TX_EXTMVC_Configuration_Container
+        * @throws TX_EXTMVC_Configuration_Exception_NoSuchFile if the specified file does not exist
         */
        public function load($pathAndFilename);
 }
index db7632b..0be73a1 100755 (executable)
@@ -30,27 +30,29 @@ declare(ENCODING = 'utf-8');
 abstract class TX_EXTMVC_Controller_AbstractController {
 
        /**
-        * @var F3_FLOW3_Object_FactoryInterface A reference to the Object Factory
-        */
-       protected $objectFactory;
-
-       /**
-        * @var string Key of the package this controller belongs to
+        * @var string Key of the extension this controller belongs to
         */
        protected $extensionKey;
 
        /**
-        * @var F3_FLOW3_Package_Package The package this controller belongs to
+        * @var F3_FLOW3_Package_Package The extension this controller belongs to
         */
-       protected $package;
+       protected $extension;
 
        /**
-        * Contains the settings of the current package
+        * Contains the settings of the current extension
         *
         * @var array
         */
        protected $settings;
 
+       /**
+        * Contains the persistence session of the current extension
+        *
+        * @var TX_EXTMVC_Persistence_Session
+        */
+       protected $session;
+
        /**
         * Constructs the controller.
         *
@@ -58,23 +60,33 @@ abstract class TX_EXTMVC_Controller_AbstractController {
         * @param F3_FLOW3_Package_ManagerInterface $packageManager A reference to the Package Manager
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function __construct(F3_FLOW3_Object_FactoryInterface $objectFactory, F3_FLOW3_Package_ManagerInterface $packageManager) {
-               $this->objectFactory = $objectFactory;
-               list(, $this->extensionKey) = explode('\\', get_class($this));
-               // $this->package = $packageManager->getPackage($this->extensionKey);
+       public function __construct() {
+               list(, $this->extensionKey) = explode('_', get_class($this));
+               // $this->extension = $packageManager->getPackage($this->extensionKey);
        }
 
        /**
-        * Sets / injects the settings of the package this controller belongs to.
+        * Injects the settings of the extension.
         *
-        * @param array $settings Settings container of the current package
+        * @param array $settings Settings container of the current extension
         * @return void
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function setSettings(array $settings) {
+       public function injectSettings(array $settings) {
                $this->settings = $settings;
        }
 
+       /**
+        * Injects the session of the extension.
+        *
+        * @param array $session Persistence session of the current extension
+        * @return void
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
+        */
+       public function injectSession(TX_EXTMVC_Persistence_Session $session) {
+               $this->session = $session;
+       }
+
        /**
         * Initializes this object after all dependencies have been resolved.
         *
index e2d0f5a..256ef90 100644 (file)
@@ -147,7 +147,7 @@ class Arguments extends ArrayObject {
         * @author Robert Lemke <robert@typo3.org>
         */
        public function addNewArgument($name, $dataType = 'Text', $isRequired = FALSE) {
-               $argument = $this->objectFactory->create('F3_FLOW3_MVC_Controller_Argument', $name, $dataType);
+               $argument = $this->objectFactory->create('TX_EXTMVC_Controller_Argument', $name, $dataType);
                $argument->setRequired($isRequired);
 
                if ($this->objectManager->isObjectRegistered($dataType)) {
index e16272e..8c2f969 100644 (file)
@@ -60,7 +60,7 @@ class ArgumentsValidator implements F3_FLOW3_Validation_ObjectValidatorInterface
         * @return boolean TRUE if this validator can validate the class type or FALSE if it can't
         */
        public function canValidate($className) {
-               return ($className === 'F3_FLOW3_MVC_Controller_Arguments');
+               return ($className === 'TX_EXTMVC_Controller_Arguments');
        }
 
        /**
index 8cf9239..e18ca47 100755 (executable)
@@ -56,7 +56,7 @@ class TX_EXTMVC_Controller_DefaultController extends TX_EXTMVC_Controller_Reques
        public function processRequest(TX_EXTMVC_Request $request, TX_EXTMVC_Response $response) {
                $request->setDispatched(TRUE);
                switch (get_class($request)) {
-                       case 'F3_FLOW3_MVC_Web_Request' :
+                       case 'TX_EXTMVC_Web_Request' :
                                $this->processWebRequest($request, $response);
                                break;
                        default :
index ff94f74..02a7c0b 100644 (file)
@@ -67,7 +67,7 @@ class TX_EXTMVC_Controller_RequestHandlingController extends TX_EXTMVC_Controlle
         * @author Robert Lemke <robert@typo3.org>
         */
        public function __construct() {
-               // $this->arguments = $objectFactory->create('F3_FLOW3_MVC_Controller_Arguments');
+               // $this->arguments = $objectFactory->create('TX_EXTMVC_Controller_Arguments');
                // parent::__construct($objectFactory, $packageManager);
        }
 
@@ -218,7 +218,7 @@ class TX_EXTMVC_Controller_RequestHandlingController extends TX_EXTMVC_Controlle
                        if ($argument->getPropertyConverter() != NULL) $this->propertyMapper->registerPropertyConverter($argument->getPropertyConverter(), $argument->getName(), $argument->getPropertyConverterInputFormat());
                }
 
-               $argumentsValidator = $this->objectFactory->create('F3_FLOW3_MVC_Controller_ArgumentsValidator', $this->arguments);
+               $argumentsValidator = $this->objectFactory->create('TX_EXTMVC_Controller_ArgumentsValidator', $this->arguments);
                $this->propertyMapper->registerValidator($argumentsValidator);
                $this->propertyMapper->setAllowedProperties(array_merge($this->arguments->getArgumentNames(), $this->arguments->getArgumentShortNames()));
                $this->propertyMapper->map($this->request->getArguments());
index 56954bb..0eb9715 100644 (file)
@@ -24,12 +24,10 @@ declare(ENCODING = 'utf-8');
 /**
  * An "Invalid Class" exception
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class InvalidClass extends F3_FLOW3_Persistence_Exception {
+class InvalidClass extends TX_EXTMVC_Persistence_Exception {
 }
 
 ?>
\ No newline at end of file
index f5be383..4e188b9 100644 (file)
@@ -24,12 +24,10 @@ declare(ENCODING = 'utf-8');
 /**
  * An "Invalid Property Type" exception
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class InvalidPropertyType extends F3_FLOW3_Persistence_Exception {
+class InvalidPropertyType extends TX_EXTMVC_Persistence_Exception {
 }
 
 ?>
\ No newline at end of file
index c9aac85..20c4dfb 100644 (file)
@@ -24,12 +24,10 @@ declare(ENCODING = 'utf-8');
 /**
  * A "Missing Backend" exception
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class MissingBackend extends F3_FLOW3_Persistence_Exception {
+class MissingBackend extends TX_EXTMVC_Persistence_Exception {
 }
 
 ?>
\ No newline at end of file
index a30554b..86c01f2 100644 (file)
@@ -24,12 +24,10 @@ declare(ENCODING = 'utf-8');
 /**
  * A "Too Dirty" exception
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class TooDirty extends F3_FLOW3_Persistence_Exception {
+class TooDirty extends TX_EXTMVC_Persistence_Exception {
 }
 
 ?>
\ No newline at end of file
index 6a910fc..6287c85 100644 (file)
@@ -21,11 +21,11 @@ declare(ENCODING = 'utf-8');
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Persistence/TX_EXTMVC_Persistence_ObjectStorage.php');
+
 /**
  * A persistence backend interface
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
@@ -42,18 +42,18 @@ interface BackendInterface {
        /**
         * Sets the aggregate root objects
         *
-        * @param SplObjectStorage $objects
+        * @param TX_EXTMVC_Persistence_ObjectStorage $objects
         * @return void
         */
-       public function setAggregateRootObjects(_SplObjectStorage $objects);
+       public function setAggregateRootObjects(TX_EXTMVC_Persistence_ObjectStorage $objects);
 
        /**
         * Sets the deleted objects
         *
-        * @param SplObjectStorage $objects
+        * @param TX_EXTMVC_Persistence_ObjectStorage $objects
         * @return void
         */
-       public function setDeletedObjects(_SplObjectStorage $objects);
+       public function setDeletedObjects(TX_EXTMVC_Persistence_ObjectStorage $objects);
 
        /**
         * Commits the current persistence session
index 0cd1bd1..92de620 100644 (file)
@@ -24,8 +24,6 @@ declare(ENCODING = 'utf-8');
 /**
  * A class schema
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
@@ -98,7 +96,7 @@ class ClassSchema {
                if (preg_match(self::ALLOWED_TYPES_PATTERN, $type, $matches)) {
                        $this->properties[$name] = ($matches[1] == 'int') ? 'integer' : $matches[1];
                } else {
-                       throw new F3_FLOW3_Persistence_Exception_InvalidPropertyType('Invalid property type encountered: ' . $type, 1220387528);
+                       throw new TX_EXTMVC_Persistence_Exception_InvalidPropertyType('Invalid property type encountered: ' . $type, 1220387528);
                }
        }
 
index 0d515ce..62a6505 100644 (file)
@@ -25,8 +25,6 @@ declare(ENCODING = 'utf-8');
  * The Class Schemata Builder is used by the Persistence Manager to build class
  * schemata for all classes tagged as ValueObject or Entity.
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
@@ -45,7 +43,7 @@ class ClassSchemataBuilder {
         * @param F3_FLOW3_Reflection_Service $reflectionService The reflection service
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function __construct(_F3_FLOW3_Reflection_Service $reflectionService) {
+       public function __construct(F3_FLOW3_Reflection_Service $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
@@ -53,27 +51,27 @@ class ClassSchemataBuilder {
         * Builds class schemata from the specified classes
         *
         * @param array $classNames Names of the classes to build schemata from
-        * @return array of F3_FLOW3_Persistence_ClassSchema
+        * @return array of TX_EXTMVC_Persistence_ClassSchema
         * @author Robert Lemke <robert@typo3.org>
-        * @throws F3_FLOW3_Persistence_Exception_InvalidClass if one of the specified classes does not exist
+        * @throws TX_EXTMVC_Persistence_Exception_InvalidClass if one of the specified classes does not exist
         */
        public function build(array $classNames) {
                $classSchemata = array();
                foreach ($classNames as $className) {
-                       if (!class_exists($className)) throw new F3_FLOW3_Persistence_Exception_InvalidClass('Unknown class "' . $className . '".', 1214495364);
+                       if (!class_exists($className)) throw new TX_EXTMVC_Persistence_Exception_InvalidClass('Unknown class "' . $className . '".', 1214495364);
 
                        $modelType = NULL;
                        if ($this->reflectionService->isClassTaggedWith($className, 'entity')) {
-                               $modelType = F3_FLOW3_Persistence_ClassSchema::MODELTYPE_ENTITY;
-                       } elseif ($this->reflectionService->isClassImplementationOf($className, 'F3_FLOW3_Persistence_RepositoryInterface')) {
-                               $modelType = F3_FLOW3_Persistence_ClassSchema::MODELTYPE_REPOSITORY;
+                               $modelType = TX_EXTMVC_Persistence_ClassSchema::MODELTYPE_ENTITY;
+                       } elseif ($this->reflectionService->isClassImplementationOf($className, 'TX_EXTMVC_Persistence_RepositoryInterface')) {
+                               $modelType = TX_EXTMVC_Persistence_ClassSchema::MODELTYPE_REPOSITORY;
                        } elseif ($this->reflectionService->isClassTaggedWith($className, 'valueobject')) {
-                               $modelType = F3_FLOW3_Persistence_ClassSchema::MODELTYPE_VALUEOBJECT;
+                               $modelType = TX_EXTMVC_Persistence_ClassSchema::MODELTYPE_VALUEOBJECT;
                        } else {
                                continue;
                        }
 
-                       $classSchema = new F3_FLOW3_Persistence_ClassSchema($className);
+                       $classSchema = new TX_EXTMVC_Persistence_ClassSchema($className);
                        $classSchema->setModelType($modelType);
                        foreach ($this->reflectionService->getClassPropertyNames($className) as $propertyName) {
                                if ($this->reflectionService->isPropertyTaggedWith($className, $propertyName, 'identifier')) {
index 70f0629..3a893db 100644 (file)
@@ -24,8 +24,6 @@ declare(ENCODING = 'utf-8');
 /**
  * A generic Persistence exception
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
index 9d22087..f48eb1c 100644 (file)
@@ -21,15 +21,15 @@ declare(ENCODING = 'utf-8');
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Persistence/TX_EXTMVC_Persistence_ObjectStorage.php');
+
 /**
  * The FLOW3 Persistence Manager
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Manager implements F3_FLOW3_Persistence_ManagerInterface {
+class Manager implements TX_EXTMVC_Persistence_ManagerInterface {
 
        /**
         * The reflection service
@@ -41,17 +41,17 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
        /**
         * The class schema builder
         *
-        * @var F3_FLOW3_Persistence_ClassSchemataBuilder
+        * @var TX_EXTMVC_Persistence_ClassSchemataBuilder
         */
        protected $classSchemataBuilder;
 
        /**
-        * @var F3_FLOW3_Persistence_BackendInterface
+        * @var TX_EXTMVC_Persistence_BackendInterface
         */
        protected $backend;
 
        /**
-        * @var F3_FLOW3_Persistence_Session
+        * @var TX_EXTMVC_Persistence_Session
         */
        protected $session;
 
@@ -63,17 +63,17 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
        /**
         * Schemata of all classes which need to be persisted
         *
-        * @var array of F3_FLOW3_Persistence_ClassSchema
+        * @var array of TX_EXTMVC_Persistence_ClassSchema
         */
        protected $classSchemata = array();
 
        /**
         * Constructor
         *
-        * @param F3_FLOW3_Persistence_BackendInterface $backend the backend to use for persistence
+        * @param TX_EXTMVC_Persistence_BackendInterface $backend the backend to use for persistence
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
-       public function __construct(_F3_FLOW3_Persistence_BackendInterface $backend) {
+       public function __construct(TX_EXTMVC_Persistence_BackendInterface $backend) {
                $this->backend = $backend;
        }
 
@@ -84,29 +84,29 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
         * @return void
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
-       public function injectReflectionService(_F3_FLOW3_Reflection_Service $reflectionService) {
+       public function injectReflectionService(F3_FLOW3_Reflection_Service $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
        /**
         * Injects the class schemata builder
         *
-        * @param F3_FLOW3_Persistence_ClassSchemataBuilder $classSchemataBuilder The class schemata builder
+        * @param TX_EXTMVC_Persistence_ClassSchemataBuilder $classSchemataBuilder The class schemata builder
         * @return void
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
-       public function injectClassSchemataBuilder(_F3_FLOW3_Persistence_ClassSchemataBuilder $classSchemataBuilder) {
+       public function injectClassSchemataBuilder(TX_EXTMVC_Persistence_ClassSchemataBuilder $classSchemataBuilder) {
                $this->classSchemataBuilder = $classSchemataBuilder;
        }
 
        /**
         * Injects the persistence session
         *
-        * @param F3_FLOW3_Persistence_Session $session The persistence session
+        * @param TX_EXTMVC_Persistence_Session $session The persistence session
         * @return void
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function injectSession(_F3_FLOW3_Persistence_Session $session) {
+       public function injectSession(TX_EXTMVC_Persistence_Session $session) {
                $this->session = $session;
        }
 
@@ -117,7 +117,7 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
         * @return void
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function injectObjectManager(_F3_FLOW3_Object_ManagerInterface $objectManager) {
+       public function injectObjectManager(F3_FLOW3_Object_ManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
        }
 
@@ -128,7 +128,7 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
         * @author Robert Lemke <robert@typo3.org>
         */
        public function initialize() {
-               if (!$this->backend instanceof F3_FLOW3_Persistence_BackendInterface) throw new F3_FLOW3_Persistence_Exception_MissingBackend('A persistence backend must be set prior to initializing the persistence manager.', 1215508456);
+               if (!$this->backend instanceof TX_EXTMVC_Persistence_BackendInterface) throw new TX_EXTMVC_Persistence_Exception_MissingBackend('A persistence backend must be set prior to initializing the persistence manager.', 1215508456);
                $classNames = array_merge($this->reflectionService->getClassNamesByTag('entity'),
                        $this->reflectionService->getClassNamesByTag('valueobject'));
 
@@ -139,7 +139,7 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
        /**
         * Returns the current persistence session
         *
-        * @return F3_FLOW3_Persistence_Session
+        * @return TX_EXTMVC_Persistence_Session
         * @author Robert Lemke <robert@typo3.org>
         */
        public function getSession() {
@@ -149,7 +149,7 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
        /**
         * Returns the persistence backend
         *
-        * @return F3_FLOW3_Persistence_BackendInterface
+        * @return TX_EXTMVC_Persistence_BackendInterface
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
        public function getBackend() {
@@ -160,7 +160,7 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
         * Returns the class schema for the given class
         *
         * @param string $className
-        * @return F3_FLOW3_Persistence_ClassSchema
+        * @return TX_EXTMVC_Persistence_ClassSchema
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
        public function getClassSchema($className) {
@@ -177,11 +177,11 @@ class Manager implements F3_FLOW3_Persistence_ManagerInterface {
         * @todo eventually replace foreach/attach with a merge method if added to PHP
         */
        public function persistAll() {
-               $aggregateRootObjects = new SplObjectStorage();
-               $removedObjects = new SplObjectStorage();
+               $aggregateRootObjects = new TX_EXTMVC_Persistence_ObjectStorage();
+               $removedObjects = new TX_EXTMVC_Persistence_ObjectStorage();
 
                        // fetch and inspect objects from all known repositories
-               $repositoryClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('F3_FLOW3_Persistence_RepositoryInterface');
+               $repositoryClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('TX_EXTMVC_Persistence_RepositoryInterface');
                foreach ($repositoryClassNames as $repositoryClassName) {
                        $repository = $this->objectManager->getObject($repositoryClassName);
                        $objects = $repository->getObjects();
index 778fa55..2bf3608 100644 (file)
@@ -24,8 +24,6 @@ declare(ENCODING = 'utf-8');
 /**
  * The FLOW3 Persistence Manager interface
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
@@ -41,14 +39,14 @@ interface ManagerInterface {
        /**
         * Returns the current persistence session
         *
-        * @return F3_FLOW3_Persistence_Session
+        * @return TX_EXTMVC_Persistence_Session
         */
        public function getSession();
 
        /**
         * Returns the persistence backend
         *
-        * @return F3_FLOW3_Persistence_BackendInterface
+        * @return TX_EXTMVC_Persistence_BackendInterface
         */
        public function getBackend();
 
@@ -56,7 +54,7 @@ interface ManagerInterface {
         * Returns the class schema for the given class
         *
         * @param string $className
-        * @return F3_FLOW3_Persistence_ClassSchema
+        * @return TX_EXTMVC_Persistence_ClassSchema
         */
        public function getClassSchema($className);
 
diff --git a/typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_ObjectStorage.php b/typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_ObjectStorage.php
new file mode 100644 (file)
index 0000000..ff2ef17
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+declare(ENCODING = 'utf-8');
+
+/*                                                                        *
+ * This script belongs to the FLOW3 framework.                            *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * The storage for objects. It ensures the uniqueness of an object in the storage. It's a remake of the
+ * SplObjectStorage introduced in a usable version in PHP 5.3.
+ *
+ * @version $Id:$
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class TX_EXTMVC_Persistence_ObjectStorage implements Iterator, Countable {
+       
+       /**
+        * The array holding references to the stored objects.
+        *
+        * @var string
+        **/
+       private $storage = array();
+       
+       /**
+        * An index for the Iterator interface
+        *
+        * @var string
+        **/
+       private $index = 0;
+
+       function rewind() {
+               rewind($this->storage);
+       }
+
+       function valid() {
+               return key($this->storage) !== false;
+       }
+
+       function key() {
+               return $this->index;
+       }
+
+       function current() {
+               return current($this->storage);
+       }
+
+       function next() {
+               next($this->storage);
+               $this->index++;
+       }
+
+       function count() {
+               return count($this->storage);
+       }
+
+       /**
+        * Does the Storage contains the given object
+        *
+        * @param Object $obj 
+        * @return boolean TRUE|FALSE The result TRUE if the Storage contains the object; the result FALSE if not
+        */
+       function contains($obj) {
+               if (is_object($obj)) {
+                       foreach($this->storage as $object) {
+                               if ($object === $obj) return true;
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * Attaches an object to the storage
+        *
+        * @param Object $obj 
+        * @return void
+        */
+       function attach($obj) {
+               if (is_object($obj) && !$this->contains($obj)) {
+                       $this->storage[] = $obj;
+               }
+       }
+
+       /**
+        * Detaches an object to the storage
+        *
+        * @param Object $obj 
+        * @return void
+        */
+       function detach($obj) {
+               if (is_object($obj)) {
+                       foreach($this->storage as $idx => $object) {
+                               if ($object === $obj) {
+                                       unset($this->storage[$idx]);
+                                       $this->rewind();
+                                       return;
+                               }
+                       }
+               }
+       }
+}
+
+?>
\ No newline at end of file
index bf0e033..d00b52c 100644 (file)
@@ -24,8 +24,6 @@ declare(ENCODING = 'utf-8');
 /**
  * A persistence query factory interface
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
index 6d99f94..d4611a2 100644 (file)
@@ -24,8 +24,6 @@ declare(ENCODING = 'utf-8');
 /**
  * A persistence query interface
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
@@ -42,7 +40,7 @@ interface QueryInterface {
         * The constraint used to limit the result set
         *
         * @param mixed $constraint Some constraint, depending on the backend
-        * @return F3_FLOW3_Persistence_QueryInterface
+        * @return TX_EXTMVC_Persistence_QueryInterface
         */
        public function matching($constraint);
 
@@ -51,7 +49,7 @@ interface QueryInterface {
         *
         * @param string $property The name of the property to compare against
         * @param mixed $operand The value to compare with
-        * @return F3_FLOW3_Persistence_OperatorInterface
+        * @return TX_EXTMVC_Persistence_OperatorInterface
         */
        public function equals($property, $operand);
 
@@ -60,7 +58,7 @@ interface QueryInterface {
         *
         * @param string $property The name of the property to compare against
         * @param mixed $operand The value to compare with
-        * @return F3_FLOW3_Persistence_OperatorInterface
+        * @return TX_EXTMVC_Persistence_OperatorInterface
         */
        public function like($property, $operand);
 
@@ -69,7 +67,7 @@ interface QueryInterface {
         *
         * @param string $property The name of the property to compare against
         * @param mixed $operand The value to compare with
-        * @return F3_FLOW3_Persistence_OperatorInterface
+        * @return TX_EXTMVC_Persistence_OperatorInterface
         */
        public function lessThan($property, $operand);
 
@@ -78,7 +76,7 @@ interface QueryInterface {
         *
         * @param string $property The name of the property to compare against
         * @param mixed $operand The value to compare with
-        * @return F3_FLOW3_Persistence_OperatorInterface
+        * @return TX_EXTMVC_Persistence_OperatorInterface
         */
        public function lessThanOrEqual($property, $operand);
 
@@ -87,7 +85,7 @@ interface QueryInterface {
         *
         * @param string $property The name of the property to compare against
         * @param mixed $operand The value to compare with
-        * @return F3_FLOW3_Persistence_OperatorInterface
+        * @return TX_EXTMVC_Persistence_OperatorInterface
         */
        public function greaterThan($property, $operand);
 
@@ -96,7 +94,7 @@ interface QueryInterface {
         *
         * @param string $property The name of the property to compare against
         * @param mixed $operand The value to compare with
-        * @return F3_FLOW3_Persistence_OperatorInterface
+        * @return TX_EXTMVC_Persistence_OperatorInterface
         */
        public function greaterThanOrEqual($property, $operand);
 
index 85dc0f8..ab6353f 100644 (file)
@@ -21,34 +21,30 @@ declare(ENCODING = 'utf-8');
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Persistence/TX_EXTMVC_Persistence_ObjectStorage.php');
+require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Persistence/TX_EXTMVC_Persistence_RepositoryInterface.php');
+
 /**
  * The base repository - will usually be extended by a more concrete repository.
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Repository implements F3_FLOW3_Persistence_RepositoryInterface {
+class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence_RepositoryInterface {
 
        /**
         * Objects of this repository
         *
-        * @var SplObjectStorage
+        * @var TX_EXTMVC_Persistence_ObjectStorage
         */
        protected $objects;
 
        /**
-        * Objects removed but not found in $this->objects at removal time
+        * Contains the persistence session of the current extension
         *
-        * @var SplObjectStorage
+        * @var TX_EXTMVC_Persistence_Session
         */
-       protected $removedObjects;
-
-       /**
-        * @var F3_FLOW3_Persistence_QueryFactoryInterface
-        */
-       protected $queryFactory;
+       protected $session;
 
        /**
         * Constructs a new Repository
@@ -56,21 +52,9 @@ class Repository implements F3_FLOW3_Persistence_RepositoryInterface {
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
        public function __construct() {
-               $this->objects = new SplObjectStorage();
-               $this->removedObjects = new SplObjectStorage();
-       }
-
-       /**
-        * Injects a QueryFactory instance
-        *
-        * @param F3_FLOW3_Persistence_QueryFactoryInterface $queryFactory
-        * @return void
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        */
-       public function injectQueryFactory(_F3_FLOW3_Persistence_QueryFactoryInterface $queryFactory) {
-               $this->queryFactory = $queryFactory;
+               $this->objects = new TX_EXTMVC_Persistence_ObjectStorage();
        }
-
+       
        /**
         * Adds an object to this repository
         *
@@ -81,88 +65,42 @@ class Repository implements F3_FLOW3_Persistence_RepositoryInterface {
         */
        public function add($object) {
                $this->objects->attach($object);
-               $this->removedObjects->detach($object);
+               $this->session->registerAddedObject($object);
        }
 
        /**
-        * Removes an object from this repository. If it is contained in $this->objects
-        * we just remove it there, since this means it has never been persisted yet.
-        *
-        * Else we keep the object around to check if we need to remove it from the
-        * storage layer.
+        * Removes an object from this repository.
         *
         * @param object $object The object to remove
         * @return void
-        * @author Robert Lemke <robert@typo3.org>
-        * @author Karsten Dambekalns <karsten@typo3.org>
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
         */
        public function remove($object) {
-               if ($this->objects->contains($object)) {
-                       $this->objects->detach($object);
-               } else {
-                       $this->removedObjects->attach($object);
-               }
-       }
-
-       /**
-        * Returns all objects that have been added to this repository with add().
-        *
-        * This is a service method for the persistence manager to get all objects
-        * added to the repository. Those are only objects *added*, not objects
-        * fetched from the underlying storage.
-        *
-        * @return SplObjectStorage the objects
-        * @author Robert Lemke <robert@typo3.org>
-        */
-       public function getObjects() {
-               return $this->objects;
-       }
-
-       /**
-        * Returns an SplObjectStorage with objects remove()d from the repository
-        * that had been persisted to the storage layer before.
-        *
-        * @return SplObjectStorage the objects
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        */
-       public function getRemovedObjects() {
-               return $this->removedObjects;
+               $this->objects->detach($object);
+               $this->removedObjects->attach($object);
        }
 
        /**
         * Returns all objects of this repository
         *
         * @return array An array of objects, empty if no objects found
-        * @author Robert Lemke <robert@typo3.org>
-        * @author Karsten Dambekalns <karsten@typo3.org>
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
         */
        public function findAll() {
-               return $this->createQuery()->execute();
+               // TODO Reimplement the findAll() method
        }
-
-       /**
-        * Returns a query for objects of this repository
-        *
-        * @return F3_FLOW3_Persistence_QueryInterface
-        * @author Robert Lemke <robert@typo3.org>
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        */
-       public function createQuery() {
-               $type = str_replace('Repository', '', $this->AOPProxyGetProxyTargetClassName());
-               return $this->queryFactory->create($type);
-       }
-
+       
        /**
-        * Returns the class name of this class. Seems useless until you think about
-        * the possibility of $this *not* being an AOP proxy. If $this is an AOP proxy
-        * this method will be overridden.
-        *
-        * @return string
-        * @author Karsten Dambekalns <karsten@typo3.org>
+        * Sets the persistence session
+        * 
+        * @param TX_EXTMVC_Persistence_Session $session The persistence session
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
         */
-       protected function AOPProxyGetProxyTargetClassName() {
-               return get_class($this);
+       public function setSession(TX_EXTMVC_Persistence_Session $session) {
+               $this->session = $session;
        }
+       
+       // TODO implement magic find functions for public properties
 
 }
 ?>
\ No newline at end of file
index 0d03693..0d2c145 100644 (file)
@@ -21,22 +21,14 @@ declare(ENCODING = 'utf-8');
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
-/**
- * @package FLOW3
- * @subpackage Persistence
- * @version $Id:$
- */
-
 /**
  * Contract for a repository
  *
- * @package FLOW3
- * @subpackage Persistence
  * @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>
  */
-interface RepositoryInterface {
+interface TX_EXTMVC_Persistence_RepositoryInterface {
 
        /**
         * Adds an object to this repository.
@@ -54,21 +46,5 @@ interface RepositoryInterface {
         */
        public function remove($object);
 
-       /**
-        * Returns all objects of this repository add()ed but not yet persisted to
-        * the storage layer.
-        *
-        * @return array An array of objects
-        */
-       public function getObjects();
-
-       /**
-        * Returns an array with objects remove()d from the repository that
-        * had been persisted to the storage layer before.
-        *
-        * @return array
-        */
-       public function getRemovedObjects();
-
 }
 ?>
\ No newline at end of file
index 4cc68b8..1282084 100644 (file)
@@ -1,4 +1,4 @@
-       <?php
+<?php
 declare(ENCODING = 'utf-8');
 
 /*                                                                        *
@@ -21,21 +21,35 @@ declare(ENCODING = 'utf-8');
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
+require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Persistence/TX_EXTMVC_Persistence_ObjectStorage.php');
+
 /**
- * The persistence session - acts as a Unit of Work for FLOW3's persistence framework.
+ * The persistence session - acts as a Unit of Work for EXCMVC's persistence framework.
  *
- * @package FLOW3
- * @subpackage Persistence
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @prototype
  */
-class Session {
+class TX_EXTMVC_Persistence_Session {
+               
+       /**
+        * Objects added to the repository but not yet persisted
+        *
+        * @var TX_EXTMVC_Persistence_ObjectStorage
+        */
+       protected $addedObjects;
+
+       /**
+        * Objects removed but not yet persisted
+        *
+        * @var TX_EXTMVC_Persistence_ObjectStorage
+        */
+       protected $removedObjects;
 
        /**
         * Reconstituted objects
         *
-        * @var SplObjectStorage
+        * @var TX_EXTMVC_Persistence_ObjectStorage
         */
        protected $reconstitutedObjects;
 
@@ -45,7 +59,73 @@ class Session {
         * @author Karsten Dambekalns <karsten@typo3.org>
         */
        public function __construct() {
-               $this->reconstitutedObjects = new SplObjectStorage();
+               $this->addedObjects = new TX_EXTMVC_Persistence_ObjectStorage();
+               $this->removedObjects = new TX_EXTMVC_Persistence_ObjectStorage();
+               $this->reconstitutedObjects = new TX_EXTMVC_Persistence_ObjectStorage();
+       }
+
+       /**
+        * Registers an added object
+        *
+        * @param object $object
+        * @return void
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
+        */
+       public function registerAddedObject($object) {
+               $this->addedObjects->attach($object);
+       }
+
+       /**
+        * Unegisters an added object
+        *
+        * @param object $object
+        * @return void
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
+        */
+       public function unregisterAddedObject($object) {
+               $this->addedObjects->detach($object);
+       }
+       
+       /**
+        * Returns all objects which have been registered as added objects
+        *
+        * @return array All added objects
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
+        */
+       public function getAddedObjects() {
+               return $this->addedObjects;
+       }
+
+       /**
+        * Registers a removed object
+        *
+        * @param object $object
+        * @return void
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
+        */
+       public function registerRemovedObject($object) {
+               $this->removedObjects->attach($object);
+       }
+
+       /**
+        * Unegisters a removed object
+        *
+        * @param object $object
+        * @return void
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
+        */
+       public function unregisterRemovedObject($object) {
+               $this->removedObjects->detach($object);
+       }
+       
+       /**
+        * Returns all objects which have been registered as removed objects
+        *
+        * @return array All removed objects
+        * @author Jochen Rau <jochen.rau@typoplanet.de>
+        */
+       public function getRemovedObjects() {
+               return $this->removedObjects;
        }
 
        /**
@@ -81,4 +161,4 @@ class Session {
        }
 
 }
-?>
+?>
\ No newline at end of file
index 2e038e0..1dfe3db 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 declare(ENCODING = 'utf-8');
-namespace F3_FLOW3_MVC;
 
 /*                                                                        *
  * This script belongs to the FLOW3 framework.                            *
@@ -33,7 +32,7 @@ namespace F3_FLOW3_MVC;
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class DefaultRequestHandler implements F3_FLOW3_MVC_RequestHandlerInterface {
+class DefaultRequestHandler implements TX_EXTMVC_RequestHandlerInterface {
 
        /**
         * Handles the request
index 6d867d3..21f47f2 100644 (file)
@@ -176,7 +176,7 @@ class TX_EXTMVC_Request {
 
        /**
         * Returns the view's (possible) object name according to the defined view object
-        * name pattern and the specified values for package, controller, action and format.
+        * name pattern and the specified values for extension, controller, action and format.
         *
         * If no valid view object name could be resolved, FALSE is returned
         *
index fb67a64..7a9bb04 100644 (file)
@@ -33,7 +33,7 @@ class RequestProcessorChainManager {
        /**
         * @var array Supported request types
         */
-       protected $supportedRequestTypes = array('F3_FLOW3_MVC_Request', 'F3_FLOW3_MVC_Web_Request', 'F3_FLOW3_MVC_CLI_Request');
+       protected $supportedRequestTypes = array('TX_EXTMVC_Request', 'TX_EXTMVC_Web_Request', 'TX_EXTMVC_CLI_Request');
 
        /**
         * @var array Registered request processors, grouped by request type
index 7db04d7..551fd3a 100644 (file)
@@ -52,8 +52,8 @@ class TX_EXTMVC_View_Helper_URIHelper extends TX_EXTMVC_View_Helper_AbstractHelp
         * @param string $actionName Name of the action to be called
         * @param array $arguments Additional arguments
         * @param string $controllerName Name of the target controller. If not set, current controller is used
-        * @param string $extensionKey Name of the target package. If not set, current package is used
-        * @param string $subextensionKey Name of the target subpackage. If not set, current subpackage is used
+        * @param string $extensionKey Name of the target extension. If not set, current extension is used
+        * @param string $subextensionKey Name of the target subextension. If not set, current subextension is used
         * @param array $options Further options
         * @return string the HTML code for the generated link
         * @see UIRFor()
@@ -70,8 +70,8 @@ class TX_EXTMVC_View_Helper_URIHelper extends TX_EXTMVC_View_Helper_AbstractHelp
         * @param string $actionName Name of the action to be called
         * @param array $arguments Additional arguments
         * @param string $controllerName Name of the target controller. If not set, current controller is used
-        * @param string $extensionKey Name of the target package. If not set, current package is used
-        * @param string $subextensionKey Name of the target subpackage. If not set, current subpackage is used
+        * @param string $extensionKey Name of the target extension. If not set, current extension is used
+        * @param string $subextensionKey Name of the target subextension. If not set, current subextension is used
         * @param array $options Further options
         * @return string the HTML code for the generated link
         * @author Bastian Waidelich <bastian@typo3.org>
@@ -83,9 +83,9 @@ class TX_EXTMVC_View_Helper_URIHelper extends TX_EXTMVC_View_Helper_AbstractHelp
                $routeValues['@extension'] = ($extensionKey === NULL) ? $this->request->getControllerExtensionKey() : $extensionKey;
                $currentSubextensionKey = $this->request->getControllerSubextensionKey();
                if ($subextensionKey === NULL && strlen($currentSubextensionKey)) {
-                       $routeValues['@subpackage'] = $currentSubextensionKey;
+                       $routeValues['@subextension'] = $currentSubextensionKey;
                } else if (strlen($subextensionKey)) {
-                       $routeValues['@subpackage'] = $subextensionKey;
+                       $routeValues['@subextension'] = $subextensionKey;
                }
 
                $URIString = $this->router->resolve($routeValues);
index 6d2c654..1f361bf 100755 (executable)
@@ -44,7 +44,7 @@ class TX_EXTMVC_View_DefaultView extends TX_EXTMVC_View_AbstractView {
        public function render() {
                if (!is_object($this->request)) throw new TX_EXTMVC_Exception('Can\'t render view without request object.', 1192450280);
 
-               $template = $this->objectFactory->create('F3_FLOW3_MVC_View_Template');
+               $template = $this->objectFactory->create('TX_EXTMVC_View_Template');
                $template->setTemplateResource($this->resourceManager->getResource('file://FLOW3/Public/MVC/DefaultView_Template.html')->getContent());
 
                if ($this->request instanceof TX_EXTMVC_Web_Request) {
index 1ca67ba..cb60119 100644 (file)
@@ -30,18 +30,18 @@ declare(ENCODING = 'utf-8');
 class TX_EXTMVC_Web_RequestBuilder {
 
        /**
-        * @var F3_FLOW3_Configuration_Manager
+        * @var TX_EXTMVC_Configuration_Manager
         */
        protected $configurationManager;
 
        /**
         * Injects the configuration manager
         *
-        * @param F3_FLOW3_Configuration_Manager $configurationManager A reference to the configuration manager
+        * @param TX_EXTMVC_Configuration_Manager $configurationManager A reference to the configuration manager
         * @return void
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function injectConfigurationManager(F3_FLOW3_Configuration_Manager $configurationManager) {
+       public function injectConfigurationManager(TX_EXTMVC_Configuration_Manager $configurationManager) {
                $this->configurationManager = $configurationManager;
        }
 
@@ -57,7 +57,7 @@ class TX_EXTMVC_Web_RequestBuilder {
                // $request->setRequestURI($this->environment->getRequestURI());
                // $request->setMethod($this->environment->getRequestMethod());
                // 
-               // $routesConfiguration = $this->configurationManager->getSpecialConfiguration(F3_FLOW3_Configuration_Manager::CONFIGURATION_TYPE_ROUTES);
+               // $routesConfiguration = $this->configurationManager->getSpecialConfiguration(TX_EXTMVC_Configuration_Manager::CONFIGURATION_TYPE_ROUTES);
                // $this->router->setRoutesConfiguration($routesConfiguration);
                // $this->router->route($request);
 
index 26f9dc5..220cd5e 100755 (executable)
@@ -87,7 +87,7 @@ class RequestHandler implements TX_EXTMVC_RequestHandlerInterface {
        public function handleRequest() {
                $request = $this->requestBuilder->build();
                $this->requestProcessorChainManager->processRequest($request);
-               $response = $this->objectFactory->create('F3_FLOW3_MVC_Web_Response');
+               $response = $this->objectFactory->create('TX_EXTMVC_Web_Response');
                $this->dispatcher->dispatch($request, $response);
                $response->send();
        }
index 2762493..f62e44d 100644 (file)
@@ -32,6 +32,7 @@ require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Controller/TX_EXTMVC_Con
 require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Controller/TX_EXTMVC_Controller_RequestHandlingController.php');
 require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Controller/TX_EXTMVC_Controller_ActionController.php');
 require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/View/TX_EXTMVC_View_AbstractView.php');
+require_once(t3lib_extMgm::extPath('extmvc') . 'Classes/Persistence/TX_EXTMVC_Persistence_Session.php');
 
 // FIXIT
 require_once(t3lib_extMgm::extPath('blogexample') . 'Classes/Controller/TX_Blogexample_Controller_PostsController.php');
@@ -98,33 +99,22 @@ class TX_EXTMVC_Dispatcher {
 
                $response = t3lib_div::makeInstance('TX_EXTMVC_Web_Response');
 
-               // $getParameters = t3lib_div::_GET();
-               // $postParameters = t3lib_div::_POST();
-               // $settings = $this->configurationManager->getSettings($extensionKey);
-
-               $controller = $this->getPreparedController($request, $response);
-               $controller->processRequest($request, $response);
-               return $response->getContent();
-       }
-
-       /**
-        * Resolves, prepares and returns the controller which is specified in the request object.
-        *
-        * @param TX_EXTMVC_Request $request The current request
-        * @param TX_EXTMVC_Response $response The current response
-        * @return TX_EXTMVC_Controller_RequestHandlingController The controller
-        * @throws TX_EXTMVC_Exception_NoSuchController, TX_EXTMVC_Exception_InvalidController
-        * @author Robert Lemke <robert@typo3.org>
-        * @author Jochen Rau <jochen.rau@typoplanet.de>
-        */
-       protected function getPreparedController(TX_EXTMVC_Request $request, TX_EXTMVC_Response $response) {
                $controllerObjectName = $request->getControllerObjectName();
                $controller = t3lib_div::makeInstance($controllerObjectName);
                
                if (!$controller instanceof TX_EXTMVC_Controller_RequestHandlingController) throw new TX_EXTMVC_Exception_InvalidController('Invalid controller "' . $controllerObjectName . '". The controller must be a valid request handling controller.', 1202921619);
+               // $getParameters = t3lib_div::_GET();
+               // $postParameters = t3lib_div::_POST();
+               // $settings = $this->configurationManager->getSettings($extensionKey);
+               // $controller->injectSettings($this->configurationManager->getSettings($request->getControllerExtensionKey()));
+               $session = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session');
+               $controller->injectSession($session);
+               $controller->processRequest($request, $response);               
+               // $session->commit()
+               // $session->clear();
                
-               // $controller->setSettings($this->configurationManager->getSettings($request->getControllerExtensionKey()));
-               return $controller;
+               return $response->getContent();
        }
+
 }
 ?>
\ No newline at end of file