Merge "[TASK] Improve performance of Utility/Arrays::integerExplode"
authorMarc Bastian Heinrichs <typo3@mbh-software.de>
Mon, 30 Apr 2012 23:35:31 +0000 (01:35 +0200)
committerGerrit Code Review <gerrit@review.typo3.org>
Mon, 30 Apr 2012 23:35:31 +0000 (01:35 +0200)
212 files changed:
typo3/sysext/extbase/Classes/Command/HelpCommandController.php
typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php
typo3/sysext/extbase/Classes/Core/Bootstrap.php
typo3/sysext/extbase/Classes/Core/BootstrapInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Dispatcher.php [deleted file]
typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php
typo3/sysext/extbase/Classes/MVC/CLI/RequestHandler.php
typo3/sysext/extbase/Classes/MVC/Controller/AbstractController.php
typo3/sysext/extbase/Classes/MVC/Controller/ActionController.php
typo3/sysext/extbase/Classes/MVC/Controller/Argument.php
typo3/sysext/extbase/Classes/MVC/Controller/ArgumentError.php
typo3/sysext/extbase/Classes/MVC/Controller/ArgumentsValidator.php
typo3/sysext/extbase/Classes/MVC/Controller/ControllerContext.php
typo3/sysext/extbase/Classes/MVC/Controller/FlashMessages.php
typo3/sysext/extbase/Classes/MVC/Request.php
typo3/sysext/extbase/Classes/MVC/Web/AbstractRequestHandler.php
typo3/sysext/extbase/Classes/MVC/Web/Request.php
typo3/sysext/extbase/Classes/Object/Container/Exception/CannotInitializeCacheException.php
typo3/sysext/extbase/Classes/Object/Container/Exception/TooManyRecursionLevelsException.php
typo3/sysext/extbase/Classes/Object/Manager.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Backend.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/BackendInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception.php
typo3/sysext/extbase/Classes/Persistence/Exception/CleanStateNotMemorized.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/IllegalObjectType.php
typo3/sysext/extbase/Classes/Persistence/Exception/InvalidClass.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/InvalidNumberOfConstraints.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/InvalidPropertyType.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/MissingBackend.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/RepositoryException.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/TooDirty.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/UnexpectedTypeException.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/UnknownObject.php
typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedMethod.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedOrder.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedRelation.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/BackendInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/CleanStateNotMemorized.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidClass.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidNumberOfConstraints.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidPropertyType.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/MissingBackend.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/RepositoryException.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/TooDirty.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnexpectedTypeException.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedMethod.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedOrder.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedRelation.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/IdentityMap.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/LoadingStrategyInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Manager.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/ManagerInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/ColumnMap.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/ObjectMonitoringInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/ObjectStorage.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/PropertyType.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/AndInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/BindVariableValue.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/BindVariableValueInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/Comparison.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/ComparisonInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/Constraint.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/ConstraintInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/DynamicOperand.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/DynamicOperandInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/EquiJoinCondition.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/EquiJoinConditionInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/Join.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/JoinConditionInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/JoinInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/LogicalAnd.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/LogicalNot.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/LogicalOr.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/LowerCase.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/LowerCaseInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/NotInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/Operand.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/OperandInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/OrInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/Ordering.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/OrderingInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/PropertyValue.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/PropertyValueInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/QueryObjectModelConstantsInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/QueryObjectModelFactory.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/QueryObjectModelFactoryInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/Selector.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/SelectorInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/SourceInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/Statement.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/StaticOperand.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/StaticOperandInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/UpperCase.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QOM/UpperCaseInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Query.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactoryInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Session.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/BackendInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Exception/BadConstraint.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Exception/SqlError.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/IdentityMap.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/LazyLoadingProxy.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/LoadingStrategyInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Manager.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/ManagerInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Mapper/ColumnMap.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMap.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapFactory.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/ObjectMonitoringInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/PersistenceManagerInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/PropertyType.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/AndInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/BindVariableValue.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/BindVariableValueInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/Comparison.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/ComparisonInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/Constraint.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/ConstraintInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/DynamicOperand.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/DynamicOperandInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/EquiJoinCondition.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/EquiJoinConditionInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/Join.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/JoinConditionInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/JoinInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/LogicalAnd.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/LogicalNot.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/LogicalOr.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/LowerCase.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/LowerCaseInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/NotInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/Operand.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/OperandInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/OrInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/Ordering.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/OrderingInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/PropertyValue.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/PropertyValueInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelConstantsInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactory.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModelFactoryInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/Selector.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/SelectorInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/SourceInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/Statement.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/StaticOperand.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/StaticOperandInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/UpperCase.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QOM/UpperCaseInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Query.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QueryFactory.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QueryFactoryInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QueryInterface.php
typo3/sysext/extbase/Classes/Persistence/QueryResult.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/QueryResultInterface.php
typo3/sysext/extbase/Classes/Persistence/QuerySettingsInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Persistence/RepositoryInterface.php
typo3/sysext/extbase/Classes/Persistence/Session.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Storage/BackendInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Storage/Exception/BadConstraint.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Storage/Exception/SqlError.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Typo3QuerySettings.php [deleted file]
typo3/sysext/extbase/Classes/Property/MappingResults.php
typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php
typo3/sysext/extbase/Classes/Scheduler/FieldProvider.php
typo3/sysext/extbase/Classes/Service/CacheService.php
typo3/sysext/extbase/Classes/Service/ExtensionService.php
typo3/sysext/extbase/Classes/Utility/Cache.php
typo3/sysext/extbase/Classes/Utility/ClassLoader.php
typo3/sysext/extbase/Classes/Utility/Extension.php
typo3/sysext/extbase/Classes/Utility/TypeHandling.php
typo3/sysext/extbase/Classes/Utility/TypoScript.php
typo3/sysext/extbase/Classes/Validation/PropertyError.php
typo3/sysext/extbase/Classes/Validation/Validator/AbstractCompositeValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/AbstractObjectValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/AbstractValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/ConjunctionValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/DisjunctionValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/GenericObjectValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/ObjectValidatorInterface.php
typo3/sysext/extbase/Classes/Validation/Validator/RawValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/ValidatorInterface.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php
typo3/sysext/extbase/Tests/BaseTestCase.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Fixtures/ClassWithSettersAndConstructor.php
typo3/sysext/extbase/Tests/Unit/MVC/Controller/AbstractControllerTest.php
typo3/sysext/extbase/Tests/Unit/MVC/Controller/ArgumentBehaviorBeforeExtbase14Test.php
typo3/sysext/extbase/Tests/Unit/MVC/DispatcherTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Mapper/DataMapFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Service/CacheServiceTest.php
typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php
typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
typo3/sysext/extbase/ext_autoload.php
typo3/sysext/extbase/ext_localconf.php
typo3/sysext/extbase/ext_tables.php

index 6981c20..f5eaf6e 100644 (file)
@@ -241,4 +241,4 @@ class Tx_Extbase_Command_HelpCommandController extends Tx_Extbase_MVC_Controller
                }
        }
 }
-?>
+?>
\ No newline at end of file
index 6ff8a68..6e4e8eb 100644 (file)
@@ -131,4 +131,4 @@ class Tx_Extbase_Configuration_ConfigurationManager implements Tx_Extbase_Config
        }
 
 }
-?>
+?>
\ No newline at end of file
index 8f6604c..bf4b683 100644 (file)
@@ -193,7 +193,7 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
         *
         * @param string $flexFormContent flexForm xml string
         * @return array the processed array
-        * @deprecated since Extbase 1.4; will be removed in Extbase 1.6
+        * @deprecated since Extbase 1.4; will be removed in Extbase 6.0
         */
        protected function convertFlexformContentToArray($flexFormContent) {
                t3lib_div::logDeprecatedFunction();
@@ -202,9 +202,10 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
 
        /**
         * Parses a flexForm node recursively and takes care of sections etc
+        *
         * @param array $nodeArray The flexForm node to parse
         * @param string $valuePointer The valuePointer to use for value retrieval
-        * @deprecated since Extbase 1.4; will be removed in Extbase 1.6
+        * @deprecated since Extbase 1.4; will be removed in Extbase 6.0
         */
        protected function walkFlexformNode($nodeArray, $valuePointer = 'vDEF') {
                t3lib_div::logDeprecatedFunction();
index 6049a88..c12b8c4 100644 (file)
@@ -31,7 +31,7 @@
  * @package Extbase
  * @version $ID:$
  */
-class Tx_Extbase_Core_Bootstrap {
+class Tx_Extbase_Core_Bootstrap implements Tx_Extbase_Core_BootstrapInterface {
 
        /**
         * Back reference to the parent content object
@@ -98,7 +98,6 @@ class Tx_Extbase_Core_Bootstrap {
                $this->initializeCache();
                $this->initializeReflection();
                $this->initializePersistence();
-               $this->initializeBackwardsCompatibility();
        }
 
        /**
@@ -181,19 +180,6 @@ class Tx_Extbase_Core_Bootstrap {
        }
 
        /**
-        * 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.
         *
@@ -309,4 +295,4 @@ class Tx_Extbase_Core_Bootstrap {
        }
 
 }
-?>
\ No newline at end of file
+?>
diff --git a/typo3/sysext/extbase/Classes/Core/BootstrapInterface.php b/typo3/sysext/extbase/Classes/Core/BootstrapInterface.php
new file mode 100644 (file)
index 0000000..8512999
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/*                                                                        *
+ * This script belongs to the Extbase framework.                          *
+ *                                                                        *
+ * This class is a backport of the corresponding class of FLOW3.          *
+ * All credits go to the v5 team.                                         *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License, either version 3   *
+ * of the License, or (at your option) any later version.                 *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * Bootstrap Interface
+ *
+ * @package Extbase
+ */
+interface Tx_Extbase_Core_BootstrapInterface {
+
+       /**
+        * 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. Not used
+        * @param array $configuration The TS configuration array
+        * @return string $content The processed content
+        * @api
+        */
+       public function run($content, $configuration);
+
+        /**
+         * This method forwards the call to run(). This method is invoked by the mod.php
+         * function of TYPO3.
+         *
+         * @param string $moduleSignature
+         * @return boolean TRUE, if the request request could be dispatched
+         * @see run()
+         **/
+       public function callModule($moduleSignature);
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Dispatcher.php b/typo3/sysext/extbase/Classes/Dispatcher.php
deleted file mode 100644 (file)
index d888046..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * 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.
- *
- * 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 {
-
-       /**
-        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
-        */
-       protected static $configurationManager;
-
-       /**
-        * @var Tx_Extbase_Persistence_Manager
-        */
-       protected static $persistenceManager;
-
-       /**
-        * Injects the Configuration Manager
-        *
-        * @param Tx_Extbase_Configuration_ConfigurationManagerInterface An instance of the Configuration Manager
-        * @return void
-        */
-       public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
-               self::$configurationManager = $configurationManager;
-       }
-
-       /**
-        * Injects the Persistence Manager
-        *
-        * @param Tx_Extbase_Persistence_Manager An instance of the Persistence Manager
-        * @return void
-        */
-       public function injectPersistenceManager(Tx_Extbase_Persistence_Manager $persistenceManager) {
-               self::$persistenceManager = $persistenceManager;
-       }
-
-       /**
-        * 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
-        */
-       static public function getConfigurationManager() {
-               t3lib_div::logDeprecatedFunction();
-               return self::$configurationManager;
-       }
-
-       /**
-        * Returns the Persistance Manager
-        *
-        * @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
-        */
-       static public function getPersistenceManager() {
-               t3lib_div::logDeprecatedFunction();
-               return self::$persistenceManager;
-       }
-
-       /**
-        * Returns the settings of Extbase
-        *
-        * @return array The configuration for the Extbase framework
-        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0
-        */
-       static public function getExtbaseFrameworkConfiguration() {
-               t3lib_div::logDeprecatedFunction();
-               return self::$configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
-       }
-
-}
-?>
\ No newline at end of file
index 0739df5..d789012 100644 (file)
@@ -232,19 +232,6 @@ class Tx_Extbase_Domain_Model_FrontendUser extends Tx_Extbase_DomainObject_Abstr
         *
         * @return Tx_Extbase_Persistence_ObjectStorage An object storage containing the usergroup
         * @api
-        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0 - use Tx_Extbase_Domain_Model_FrontendUser::getUsergroup() instead
-        */
-       public function getUsergroups() {
-               t3lib_div::logDeprecatedFunction();
-               return $this->usergroup;
-       }
-
-       /**
-        * Returns the usergroups. Keep in mind that the property is called "usergroup"
-        * although it can hold several usergroups.
-        *
-        * @return Tx_Extbase_Persistence_ObjectStorage An object storage containing the usergroup
-        * @api
         */
        public function getUsergroup() {
                return $this->usergroup;
index a4e6764..51963d5 100644 (file)
@@ -47,7 +47,7 @@ class Tx_Extbase_MVC_CLI_RequestHandler implements Tx_Extbase_MVC_RequestHandler
 
        /**
         * @var Tx_Extbase_MVC_Controller_FlashMessages
-        * @deprecated since Extbase 1.1; will be removed in Extbase 1.6
+        * @deprecated since Extbase 1.1; will be removed in Extbase 6.0
         */
        protected $flashMessages;
 
@@ -70,7 +70,7 @@ class Tx_Extbase_MVC_CLI_RequestHandler implements Tx_Extbase_MVC_RequestHandler
         */
        public function injectFlashMessageContainer(Tx_Extbase_MVC_Controller_FlashMessages $flashMessageContainer) {
                $this->flashMessageContainer = $flashMessageContainer;
-                       // @deprecated since Extbase 1.1; will be removed in Extbase 1.6
+                       // @deprecated since Extbase 1.1; will be removed in Extbase 6.0
                $this->flashMessages = $flashMessageContainer;
        }
 
index 2b02740..19d8e83 100644 (file)
@@ -75,7 +75,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
 
        /**
         * @var Tx_Extbase_Property_Mapper
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        protected $deprecatedPropertyMapper;
 
@@ -93,7 +93,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
         * The results of the mapping of request arguments to controller arguments
         * @var Tx_Extbase_Property_MappingResults
         * @api
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        protected $argumentsMappingResults;
 
@@ -113,7 +113,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
 
        /**
         * @var Tx_Extbase_MVC_Controller_FlashMessages
-        * @deprecated since Extbase 1.1; will be removed in Extbase 1.6
+        * @deprecated since Extbase 1.1; will be removed in Extbase 6.0
         */
        protected $flashMessages;
 
@@ -151,7 +151,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
         *
         * @param Tx_Extbase_Property_Mapper $deprecatedPropertyMapper The property mapper
         * @return void
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        public function injectDeprecatedPropertyMapper(Tx_Extbase_Property_Mapper $deprecatedPropertyMapper) {
                $this->deprecatedPropertyMapper = $deprecatedPropertyMapper;
@@ -186,7 +186,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
         */
        public function injectFlashMessageContainer(Tx_Extbase_MVC_Controller_FlashMessages $flashMessageContainer) {
                $this->flashMessageContainer = $flashMessageContainer;
-                       // @deprecated since Extbase 1.1; will be removed in Extbase 1.6
+                       // @deprecated since Extbase 1.1; will be removed in Extbase 6.0
                $this->flashMessages = $flashMessageContainer;
        }
 
@@ -401,7 +401,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
                                }
                        }
                } else {
-                       // @deprecated since Extbase 1.4, will be removed in Extbase 1.6
+                       // @deprecated since Extbase 1.4, will be removed in Extbase 6.0
                        $optionalPropertyNames = array();
                        $allPropertyNames = $this->arguments->getArgumentNames();
                        foreach ($allPropertyNames as $propertyName) {
index 5f52b0c..3a08d59 100644 (file)
@@ -293,7 +293,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
                                }
                        }
                } else {
-                               // @deprecated since Extbase 1.4.0, will be removed with Extbase 1.6.0.
+                               // @deprecated since Extbase 1.4.0, will be removed with Extbase 6.0
                        $argumentsAreValid = TRUE;
                        $preparedArguments = array();
                        foreach ($this->arguments as $argument) {
@@ -467,7 +467,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
 
                        return $message;
                } else {
-                               // @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0.
+                               // @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
                        $this->request->setErrors($this->argumentsMappingResults->getErrors());
 
                        $errorFlashMessage = $this->getErrorFlashMessage();
@@ -511,7 +511,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
         * @return void
         * @throws Tx_Extbase_MVC_Exception_InvalidOrNoRequestHash In case request hash checking failed
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        protected function checkRequestHash() {
                if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
index 0c124d9..7db1a51 100644 (file)
@@ -380,7 +380,7 @@ class Tx_Extbase_MVC_Controller_Argument {
         * @param array Object names of the validators
         * @return Tx_Extbase_MVC_Controller_Argument Returns $this (used for fluent interface)
         * @api
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        public function setNewValidatorConjunction(array $objectNames) {
                if ($this->validator === NULL) {
@@ -410,7 +410,7 @@ class Tx_Extbase_MVC_Controller_Argument {
         *
         * @return integer one of the ORIGIN_* constants
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        public function getOrigin() {
                return $this->origin;
@@ -461,7 +461,7 @@ class Tx_Extbase_MVC_Controller_Argument {
         *
         * @param mixed $value The value of an argument
         * @return mixed
-        * @deprecated since Extbase 1.4, will be removed in Extbase 1.6.
+        * @deprecated since Extbase 1.4, will be removed in Extbase 6.0
         */
        protected function transformValue($value) {
                if (!class_exists($this->dataType)) {
@@ -532,7 +532,7 @@ class Tx_Extbase_MVC_Controller_Argument {
         * Checks if this argument has a value set.
         *
         * @return boolean TRUE if a value was set, otherwise FALSE
-        * @deprecated since Extbase 1.4.0, will be removed with Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed with Extbase 6.0
         */
        public function isValue() {
                return $this->value !== NULL;
index dc6fb77..fbe5d9e 100644 (file)
@@ -34,7 +34,7 @@
  * @version $Id$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @scope prototype
- * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+ * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
  */
 class Tx_Extbase_MVC_Controller_ArgumentError extends Tx_Extbase_Validation_PropertyError {
 
index e313c43..983d52c 100644 (file)
@@ -32,7 +32,7 @@
  * @subpackage MVC\Controller
  * @version $ID:$
  * @scope prototype
- * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0. Is only needed for old property mapper.
+ * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0. Is only needed for old property mapper.
  */
 class Tx_Extbase_MVC_Controller_ArgumentsValidator extends Tx_Extbase_Validation_Validator_AbstractObjectValidator {
 
index a4ea82a..312a5fe 100644 (file)
@@ -54,7 +54,7 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
 
        /**
         * @var Tx_Extbase_Property_MappingResults
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        protected $argumentsMappingResults;
 
@@ -133,7 +133,7 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
         *
         * @param Tx_Extbase_Property_MappingResults $argumentsMappingResults
         * @return void
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        public function setArgumentsMappingResults(Tx_Extbase_Property_MappingResults $argumentsMappingResults) {
                $this->argumentsMappingResults = $argumentsMappingResults;
@@ -144,7 +144,7 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
         *
         * @return Tx_Extbase_Property_MappingResults
         * @api
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        public function getArgumentsMappingResults() {
                return $this->argumentsMappingResults;
@@ -180,7 +180,7 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
         * Get the flash messages
         *
         * @return Tx_Extbase_MVC_Controller_FlashMessages
-        * @deprecated since Extbase 1.1; will be removed in Extbase 1.6
+        * @deprecated since Extbase 1.1; will be removed in Extbase 6.0
         */
        public function getFlashMessages() {
                t3lib_div::logDeprecatedFunction();
index 655f9a9..aec0920 100644 (file)
@@ -69,22 +69,6 @@ class Tx_Extbase_MVC_Controller_FlashMessages implements t3lib_Singleton {
        /**
         * Get all flash messages currently available.
         *
-        * @return array<string> An array of flash messages
-        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0. Use  Use getAllMessages() instead
-        */
-       public function getAll() {
-               t3lib_div::logDeprecatedFunction();
-               $flashMessages = t3lib_FlashMessageQueue::getAllMessages();
-               $messages = array();
-               foreach ($flashMessages as $flashMessage) {
-                       $messages[] = $flashMessage->getMessage();
-               }
-               return $messages;
-       }
-
-       /**
-        * Get all flash messages currently available.
-        *
         * @return array<t3lib_FlashMessage> An array of flash messages
         * @api
         * @see t3lib_FlashMessage
@@ -104,22 +88,6 @@ class Tx_Extbase_MVC_Controller_FlashMessages implements t3lib_Singleton {
        }
 
        /**
-        * Get all flash messages currently available and delete them afterwards.
-        *
-        * @return array<string>
-        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0. Use getAllMessagesAndFlush() instead
-        */
-       public function getAllAndFlush() {
-               t3lib_div::logDeprecatedFunction();
-               $flashMessages = t3lib_FlashMessageQueue::getAllMessagesAndFlush();
-               $messages = array();
-               foreach ($flashMessages as $flashMessage) {
-                       $messages[] = $flashMessage->getMessage();
-               }
-               return $messages;
-       }
-
-       /**
         * Get all flash messages currently available. And removes them from the session.
         *
         * @return array<t3lib_FlashMessage> An array of flash messages
index c2cabc6..7d0b505 100644 (file)
@@ -113,7 +113,7 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
 
        /**
         * @var array Errors that occured during this request
-        * @deprecated since Extbase 1.4.0, will be removed with Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed with Extbase 6.0
         */
        protected $errors = array();
 
@@ -437,7 +437,7 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
         *
         * @param array $errors An array of Tx_Extbase_Error_Error objects
         * @return void
-        * @deprecated since Extbase 1.4.0, will be removed with Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed with Extbase 6.0
         */
        public function setErrors(array $errors) {
                $this->errors = $errors;
@@ -447,7 +447,7 @@ class Tx_Extbase_MVC_Request implements Tx_Extbase_MVC_RequestInterface {
         * Get errors that occured during the request (e.g. argument mapping errors)
         *
         * @return array The errors that occured during the request
-        * @deprecated since Extbase 1.4.0, will be removed with Extbase 1.6.0.
+        * @deprecated since Extbase 1.4.0, will be removed with Extbase 6.0
         */
        public function getErrors() {
                return $this->errors;
index b8ffddf..12ff618 100644 (file)
@@ -48,7 +48,7 @@ abstract class Tx_Extbase_MVC_Web_AbstractRequestHandler implements Tx_Extbase_M
 
        /**
         * @var Tx_Extbase_MVC_Controller_FlashMessages
-        * @deprecated since Extbase 1.1; will be removed in Extbase 1.6
+        * @deprecated since Extbase 1.1; will be removed in Extbase 6.0
         */
        protected $flashMessages;
 
@@ -71,7 +71,7 @@ abstract class Tx_Extbase_MVC_Web_AbstractRequestHandler implements Tx_Extbase_M
         */
        public function injectFlashMessageContainer(Tx_Extbase_MVC_Controller_FlashMessages $flashMessageContainer) {
                $this->flashMessageContainer = $flashMessageContainer;
-                       // @deprecated since Extbase 1.1; will be removed in Extbase 1.6
+                       // @deprecated since Extbase 1.1; will be removed in Extbase 6.0
                $this->flashMessages = $flashMessageContainer;
        }
 
index eac242f..e0e3da5 100644 (file)
@@ -64,7 +64,7 @@ class Tx_Extbase_MVC_Web_Request extends Tx_Extbase_MVC_Request {
 
        /**
         * @var boolean TRUE if the HMAC of this request could be verified, FALSE otherwise
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        protected $hmacVerified = FALSE;
 
@@ -165,7 +165,7 @@ class Tx_Extbase_MVC_Web_Request extends Tx_Extbase_MVC_Request {
         * @param boolean $hmacVerified TRUE if request could be verified, FALSE otherwise
         * @return void
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        public function setHmacVerified($hmacVerified) {
                $this->hmacVerified = (boolean)$hmacVerified;
@@ -176,26 +176,13 @@ class Tx_Extbase_MVC_Web_Request extends Tx_Extbase_MVC_Request {
         *
         * @return boolean TRUE if request could be verified, FALSE otherwise
         * @author Sebastian Kurfürst <sebastian@typo3.org>
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
         */
        public function isHmacVerified() {
                return $this->hmacVerified;
        }
 
        /**
-        * Returns the data array of the current content object
-        *
-        * @return array data of the current cObj
-        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0. Use the ConfigurationManager to retrieve the current ContentObject
-        * @author Bastian Waidelich <bastian@typo3.org>
-        */
-       public function getContentObjectData() {
-               t3lib_div::logDeprecatedFunction();
-               $contentObject = $this->configurationManager->getContentObject();
-               return $contentObject->data;
-       }
-
-       /**
         * Set if the current request is cached.
         *
         * @param boolean $isCached
diff --git a/typo3/sysext/extbase/Classes/Object/Manager.php b/typo3/sysext/extbase/Classes/Object/Manager.php
deleted file mode 100644 (file)
index 90dc531..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Implementation of the default Extbase Object Manager
- *
- * @package Extbase
- * @subpackage Object
- * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0
- * @see Tx_Extbase_Object_ObjectManagerInterface, Tx_Extbase_Object_ObjectManager
- */
-class Tx_Extbase_Object_Manager extends Tx_Extbase_Object_ObjectManager {
-
-       /**
-        * Returns a fresh or existing instance of the object specified by $objectName.
-        *
-        * Important:
-        *
-        * If possible, instances of Prototype objects should always be created with the
-        * Object Factory's create() method and Singleton objects should rather be
-        * injected by some type of Dependency Injection.
-        *
-        * @param string $objectName The name of the object to return an instance of
-        * @return object The object instance
-        * @deprecated since Extbase 1.3.0; will be removed in Extbase 1.5.0. Please use Tx_Extbase_Object_ObjectManager instead
-        */
-       public function getObject($objectName) {
-               t3lib_div::logDeprecatedFunction();
-               $arguments = array_slice(func_get_args(), 1);
-               if (in_array('t3lib_Singleton', class_implements($objectName))) {
-                       $object = $this->get($objectName, $arguments);
-               } else {
-                       $object = $this->create($objectName, $arguments);
-               }
-               return $object;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Backend.php
deleted file mode 100644 (file)
index 2e581c9..0000000
+++ /dev/null
@@ -1,908 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * A persistence backend. This backend maps objects to the relational model of the storage backend.
- * It persists all added, removed and changed objects.
- *
- * @package Extbase
- * @subpackage Persistence
- * @version $Id$
- */
-class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendInterface, t3lib_Singleton {
-
-       /**
-        * @var Tx_Extbase_Persistence_Session
-        */
-       protected $session;
-
-       /**
-        * @var Tx_Extbase_Persistence_ObjectStorage
-        */
-       protected $aggregateRootObjects;
-
-       /**
-        * @var Tx_Extbase_Persistence_ObjectStorage
-        */
-       protected $visitedDuringPersistence;
-
-       /**
-        * @var Tx_Extbase_Persistence_IdentityMap
-        **/
-       protected $identityMap;
-
-       /**
-        * @var Tx_Extbase_Reflection_Service
-        */
-       protected $reflectionService;
-
-       /**
-        * @var Tx_Extbase_Persistence_QueryFactoryInterface
-        */
-       protected $queryFactory;
-
-       /**
-        * @var Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
-        */
-       protected $qomFactory;
-
-       /**
-        * @var Tx_Extbase_Persistence_Storage_BackendInterface
-        */
-       protected $storageBackend;
-
-       /**
-        * @var Tx_Extbase_Persistence_Mapper_DataMapper
-        */
-       protected $dataMapper;
-
-       /**
-        * The TYPO3 reference index object
-        *
-        * @var t3lib_refindex
-        **/
-       protected $referenceIndex;
-
-       /**
-        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
-        */
-       protected $configurationManager;
-
-       /**
-        * @var Tx_Extbase_SignalSlot_Dispatcher
-        */
-       protected $signalSlotDispatcher;
-
-       /**
-        * Constructs the backend
-        *
-        * @return void
-        */
-       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');
-               }
-       }
-
-       /**
-        * @param Tx_Extbase_Persistence_Session $session
-        * @return void
-        */
-       public function injectSession(Tx_Extbase_Persistence_Session $session) {
-               $this->session = $session;
-       }
-
-       /**
-        * @param Tx_Extbase_Persistence_Storage_BackendInterface $storageBackend
-        * @return void
-        */
-       public function injectStorageBackend(Tx_Extbase_Persistence_Storage_BackendInterface $storageBackend) {
-               $this->storageBackend = $storageBackend;
-       }
-
-       /**
-        * Injects the DataMapper to map nodes to objects
-        *
-        * @param Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper
-        * @return void
-        */
-       public function injectDataMapper(Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper) {
-               $this->dataMapper = $dataMapper;
-       }
-
-       /**
-        * Injects the identity map
-        *
-        * @param Tx_Extbase_Persistence_IdentityMap $identityMap
-        * @return void
-        */
-       public function injectIdentityMap(Tx_Extbase_Persistence_IdentityMap $identityMap) {
-               $this->identityMap = $identityMap;
-       }
-
-       /**
-        * Injects the Reflection Service
-        *
-        * @param Tx_Extbase_Reflection_Service
-        * @return void
-        */
-       public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
-               $this->reflectionService = $reflectionService;
-       }
-
-       /**
-        * Injects the QueryFactory
-        *
-        * @param Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory
-        * @return void
-        */
-       public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory) {
-               $this->queryFactory = $queryFactory;
-       }
-
-       /**
-        * Injects the QueryObjectModelFactory
-        *
-        * @param Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory
-        * @return void
-        */
-       public function injectQomFactory(Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory) {
-               $this->qomFactory = $qomFactory;
-       }
-
-       /**
-        * @param Tx_Extbase_SignalSlot_Dispatcher $signalSlotDispatcher
-        */
-       public function injectSignalSlotDispatcher(Tx_Extbase_SignalSlot_Dispatcher $signalSlotDispatcher) {
-               $this->signalSlotDispatcher = $signalSlotDispatcher;
-       }
-
-       /**
-        * Returns the repository session
-        *
-        * @return Tx_Extbase_Persistence_Session
-        */
-       public function getSession() {
-               return $this->session;
-       }
-
-       /**
-        * Returns the Data Mapper
-        *
-        * @return Tx_Extbase_Persistence_Mapper_DataMapper
-        */
-       public function getDataMapper() {
-               return $this->dataMapper;
-       }
-
-       /**
-        * Returns the current QOM factory
-        *
-        * @return Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
-        */
-       public function getQomFactory() {
-               return $this->qomFactory;
-       }
-
-       /**
-        * Returns the current identityMap
-        *
-        * @return Tx_Extbase_Persistence_IdentityMap
-        */
-       public function getIdentityMap() {
-               return $this->identityMap;
-       }
-
-       /**
-        * Returns the reflection service
-        *
-        * @return Tx_Extbase_Reflection_Service
-        */
-       public function getReflectionService() {
-               return $this->reflectionService;
-       }
-
-       /**
-        * Returns the number of records matching the query.
-        *
-        * @param Tx_Extbase_Persistence_QueryInterface $query
-        * @return integer
-        * @api
-        */
-       public function getObjectCountByQuery(Tx_Extbase_Persistence_QueryInterface $query) {
-               return $this->storageBackend->getObjectCountByQuery($query);
-       }
-
-       /**
-        * Returns the object data matching the $query.
-        *
-        * @param Tx_Extbase_Persistence_QueryInterface $query
-        * @return array
-        * @api
-        */
-       public function getObjectDataByQuery(Tx_Extbase_Persistence_QueryInterface $query) {
-               return $this->storageBackend->getObjectDataByQuery($query);
-       }
-
-       /**
-        * Returns the (internal) identifier for the object, if it is known to the
-        * backend. Otherwise NULL is returned.
-        *
-        * @param object $object
-        * @return string The identifier for the object if it is known, or NULL
-        */
-       public function getIdentifierByObject($object) {
-               if ($object instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
-                       $object = $object->_loadRealInstance();
-                       if (!is_object($object)) {
-                               return NULL;
-                       }
-               }
-               if ($this->identityMap->hasObject($object)) {
-                       return $this->identityMap->getIdentifierByObject($object);
-               } else {
-                       return NULL;
-               }
-       }
-
-       /**
-        * Returns the object with the (internal) identifier, if it is known to the
-        * backend. Otherwise NULL is returned.
-        *
-        * @param string $identifier
-        * @param string $className
-        * @return object The object for the identifier if it is known, or NULL
-        */
-       public function getObjectByIdentifier($identifier, $className) {
-               if ($this->identityMap->hasIdentifier($identifier, $className)) {
-                       return $this->identityMap->getObjectByIdentifier($identifier, $className);
-               } else {
-                       $query = $this->queryFactory->create($className);
-                       return $query->matching(
-                               $query->equals('uid', $identifier))
-                               ->execute()
-                               ->getFirst();
-               }
-       }
-
-       /**
-        * Checks if the given object has ever been persisted.
-        *
-        * @param object $object The object to check
-        * @return boolean TRUE if the object is new, FALSE if the object exists in the repository
-        */
-       public function isNewObject($object) {
-               return ($this->getIdentifierByObject($object) === NULL);
-       }
-
-       /**
-        * Replaces the given object by the second object.
-        *
-        * This method will unregister the existing object at the identity map and
-        * register the new object instead. The existing object must therefore
-        * already be registered at the identity map which is the case for all
-        * reconstituted objects.
-        *
-        * The new object will be identified by the uid which formerly belonged
-        * to the existing object. The existing object looses its uid.
-        *
-        * @param object $existingObject The existing object
-        * @param object $newObject The new object
-        * @return void
-        */
-       public function replaceObject($existingObject, $newObject) {
-               $existingUid = $this->getIdentifierByObject($existingObject);
-               if ($existingUid === NULL) throw new Tx_Extbase_Persistence_Exception_UnknownObject('The given object is unknown to this persistence backend.', 1238070163);
-
-               $this->identityMap->unregisterObject($existingObject);
-               $this->identityMap->registerObject($newObject, $existingUid);
-       }
-
-       /**
-        * Sets the aggregate root objects
-        *
-        * @param Tx_Extbase_Persistence_ObjectStorage $objects
-        * @return void
-        */
-       public function setAggregateRootObjects(Tx_Extbase_Persistence_ObjectStorage $objects) {
-               $this->aggregateRootObjects = $objects;
-       }
-
-       /**
-        * Sets the deleted objects
-        *
-        * @param Tx_Extbase_Persistence_ObjectStorage $objects
-        * @return void
-        */
-       public function setDeletedObjects(Tx_Extbase_Persistence_ObjectStorage $objects) {
-               $this->deletedObjects = $objects;
-       }
-
-       /**
-        * Commits the current persistence session.
-        *
-        * @return void
-        */
-       public function commit() {
-               $this->persistObjects();
-               $this->processDeletedObjects();
-       }
-
-       /**
-        * Traverse and persist all aggregate roots and their object graph.
-        *
-        * @return void
-        */
-       protected function persistObjects() {
-               $this->visitedDuringPersistence = new Tx_Extbase_Persistence_ObjectStorage();
-               foreach ($this->aggregateRootObjects as $object) {
-                       if (!$this->identityMap->hasObject($object)) {
-                               $this->insertObject($object);
-                       }
-               }
-               foreach ($this->aggregateRootObjects as $object) {
-                       $this->persistObject($object);
-               }
-       }
-
-       /**
-        * Persists the given object.
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be inserted
-        * @return void
-        */
-       protected function persistObject(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
-               if (isset($this->visitedDuringPersistence[$object])) {
-                       return;
-               }
-               $row = array();
-               $queue = array();
-               $dataMap = $this->dataMapper->getDataMap(get_class($object));
-               $properties = $object->_getProperties();
-               foreach ($properties as $propertyName => $propertyValue) {
-                       if (!$dataMap->isPersistableProperty($propertyName) || $this->propertyValueIsLazyLoaded($propertyValue)) continue;
-                       $columnMap = $dataMap->getColumnMap($propertyName);
-                       if ($propertyValue instanceof Tx_Extbase_Persistence_ObjectStorage) {
-                               if ($object->_isNew() || $propertyValue->_isDirty()) {
-                                       $this->persistObjectStorage($propertyValue, $object, $propertyName, $row);
-                               }
-                               foreach ($propertyValue as $containedObject) {
-                                       if ($containedObject instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
-                                               $queue[] = $containedObject;
-                                       }
-                               }
-                       } elseif ($propertyValue instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
-                               if ($object->_isDirty($propertyName)) {
-                                       if ($propertyValue->_isNew()) {
-                                               $this->insertObject($propertyValue);
-                                       }
-                                       $row[$columnMap->getColumnName()] = $this->getPlainValue($propertyValue);
-                               }
-                               $queue[] = $propertyValue;
-                       } elseif ($object->_isNew() || $object->_isDirty($propertyName)) {
-                               $row[$columnMap->getColumnName()] = $this->getPlainValue($propertyValue);
-                       }
-               }
-               if (count($row) > 0) {
-                       $this->updateObject($object, $row);
-                       $object->_memorizeCleanState();
-               }
-               $this->visitedDuringPersistence[$object] = $object->getUid();
-               foreach ($queue as $queuedObject) {
-                       $this->persistObject($queuedObject);
-               }
-       }
-
-       /**
-        * Checks, if the property value is lazy loaded and was not initialized
-        *
-        * @param mixed $propertyValue The property value
-        * @return bool
-        */
-       protected function propertyValueIsLazyLoaded($propertyValue) {
-               if ($propertyValue instanceof Tx_Extbase_Persistence_LazyLoadingProxy) return TRUE;
-               if ($propertyValue instanceof Tx_Extbase_Persistence_LazyObjectStorage) {
-                       if ($propertyValue->isInitialized() === FALSE) {
-                               return TRUE;
-                       }
-               }
-               return FALSE;
-       }
-
-       /**
-        * Persists a an object storage. Objects of a 1:n or m:n relation are queued and processed with the parent object. A 1:1 relation
-        * gets persisted immediately. Objects which were removed from the property were detached from the parent object. They will not be
-        * deleted by default. You have to annotate the property with "@cascade remove" if you want them to be deleted as well.
-        *
-        * @param Tx_Extbase_Persistence_ObjectStorage $objectStorage The object storage to be persisted.
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object. One of the properties holds the object storage.
-        * @param string $propertyName The name of the property holding the object storage.
-        * @param array $row The row array of the parent object to be persisted. It's passed by reference and gets filled with either a comma separated list of uids (csv) or the number of contained objects.
-        * @return void
-        */
-       protected function persistObjectStorage(Tx_Extbase_Persistence_ObjectStorage $objectStorage, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, array &$row) {
-               $className = get_class($parentObject);
-               $columnMap = $this->dataMapper->getDataMap($className)->getColumnMap($propertyName);
-               $columnName = $columnMap->getColumnName();
-               $propertyMetaData = $this->reflectionService->getClassSchema($className)->getProperty($propertyName);
-
-               foreach ($this->getRemovedChildObjects($parentObject, $propertyName) as $removedObject) {
-                       if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY && $propertyMetaData['cascade'] === 'remove') {
-                               $this->removeObject($removedObject);
-                       } else {
-                               $this->detachObjectFromParentObject($removedObject, $parentObject, $propertyName);
-                       }
-               }
-
-               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
-                       $this->deleteAllRelationsFromRelationtable($parentObject, $propertyName);
-               }
-
-               $currentUids = array();
-               $sortingPosition = 1;
-               foreach ($objectStorage as $object) {
-                       if ($object->_isNew()) {
-                               $this->insertObject($object);
-                       }
-                       $currentUids[] = $object->getUid();
-                       $this->attachObjectToParentObject($object, $parentObject, $propertyName, $sortingPosition);
-                       $sortingPosition++;
-               }
-
-               if ($columnMap->getParentKeyFieldName() === NULL) {
-                       $row[$columnMap->getColumnName()] = implode(',', $currentUids);
-               } else {
-                       $row[$columnMap->getColumnName()] = $this->dataMapper->countRelated($parentObject, $propertyName);
-               }
-       }
-
-       /**
-        * Returns the removed objects determined by a comparison of the clean property value
-        * with the actual property value.
-        *
-        * @param Tx_Extbase_DomainObject_AbstractEntity $object The object
-        * @param string $parentPropertyName The name of the property
-        * @return array An array of removed objects
-        */
-       protected function getRemovedChildObjects(Tx_Extbase_DomainObject_AbstractEntity $object, $propertyName) {
-               $removedObjects = array();
-               $cleanPropertyValue = $object->_getCleanProperty($propertyName);
-               if (is_array($cleanPropertyValue) || $cleanPropertyValue instanceof Iterator) {
-                       $propertyValue = $object->_getProperty($propertyName);
-                       foreach ($cleanPropertyValue as $containedObject) {
-                               if (!$propertyValue->contains($containedObject)) {
-                                       $removedObjects[] = $containedObject;
-                               }
-                       }
-               }
-               return $removedObjects;
-       }
-
-       /**
-        * Updates the fields defining the relation between the object and the parent object.
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
-        * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject
-        * @param string $parentPropertyName
-        * @return void
-        */
-       protected function attachObjectToParentObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, Tx_Extbase_DomainObject_AbstractEntity $parentObject, $parentPropertyName, $sortingPosition = 0) {
-               $parentDataMap = $this->dataMapper->getDataMap(get_class($parentObject));
-               $parentColumnMap = $parentDataMap->getColumnMap($parentPropertyName);
-               if ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
-                       $row = array();
-                       $parentKeyFieldName = $parentColumnMap->getParentKeyFieldName();
-                       if ($parentKeyFieldName !== NULL) {
-                               $row[$parentKeyFieldName] = $parentObject->getUid();
-                               $parentTableFieldName = $parentColumnMap->getParentTableFieldName();
-                               if ($parentTableFieldName !== NULL) {
-                                       $row[$parentTableFieldName] = $parentDataMap->getTableName();
-                               }
-                       }
-                       $childSortByFieldName = $parentColumnMap->getChildSortByFieldName();
-                       if (!empty($childSortByFieldName)) {
-                               $row[$childSortByFieldName] = $sortingPosition;
-                       }
-                       if (count($row) > 0) {
-                               $this->updateObject($object, $row);
-                       }
-               } elseif ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
-                       $this->insertRelationInRelationtable($object, $parentObject, $parentPropertyName, $sortingPosition);
-               }
-       }
-
-       /**
-        * Updates the fields defining the relation between the object and the parent object.
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
-        * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject
-        * @param string $parentPropertyName
-        * @return void
-        */
-       protected function detachObjectFromParentObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, Tx_Extbase_DomainObject_AbstractEntity $parentObject, $parentPropertyName) {
-               $parentDataMap = $this->dataMapper->getDataMap(get_class($parentObject));
-               $parentColumnMap = $parentDataMap->getColumnMap($parentPropertyName);
-               if ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
-                       $row = array();
-                       $parentKeyFieldName = $parentColumnMap->getParentKeyFieldName();
-                       if ($parentKeyFieldName !== NULL) {
-                               $row[$parentKeyFieldName] = '';
-                               $parentTableFieldName = $parentColumnMap->getParentTableFieldName();
-                               if ($parentTableFieldName !== NULL) {
-                                       $row[$parentTableFieldName] = '';
-                               }
-                       }
-                       $childSortByFieldName = $parentColumnMap->getChildSortByFieldName();
-                       if (!empty($childSortByFieldName)) {
-                               $row[$childSortByFieldName] = 0;
-                       }
-                       if (count($row) > 0) {
-                               $this->updateObject($object, $row);
-                       }
-               } elseif ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
-                       $this->deleteRelationFromRelationtable($object, $parentObject, $parentPropertyName);
-               }
-       }
-
-       /**
-        * Inserts an object in the storage backend
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be insterted in the storage
-        * @return void
-        */
-       protected function insertObject(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
-               if ($object instanceof Tx_Extbase_DomainObject_AbstractValueObject) {
-                       $result = $this->getUidOfAlreadyPersistedValueObject($object);
-                       if ($result !== FALSE) {
-                               $object->_setProperty('uid', (int)$result);
-                               return;
-                       }
-               }
-
-               $dataMap = $this->dataMapper->getDataMap(get_class($object));
-               $row = array();
-               $this->addCommonFieldsToRow($object, $row);
-               if($dataMap->getLanguageIdColumnName() !== NULL) {
-                       $row[$dataMap->getLanguageIdColumnName()] = -1;
-               }
-               $uid = $this->storageBackend->addRow(
-                       $dataMap->getTableName(),
-                       $row
-                       );
-               $object->_setProperty('uid', (int)$uid);
-
-               if ((integer)$uid >= 1) {
-                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterInsertObject', array('object' => $object));
-               }
-
-               $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);
-       }
-
-       /**
-        * Tests, if the given Value Object already exists in the storage backend and if so, it returns the uid.
-        *
-        * @param Tx_Extbase_DomainObject_AbstractValueObject $object The object to be tested
-        * @return mixed The matching uid if an object was found, else FALSE
-        */
-       protected function getUidOfAlreadyPersistedValueObject(Tx_Extbase_DomainObject_AbstractValueObject $object) {
-               return $this->storageBackend->getUidOfAlreadyPersistedValueObject($object);
-       }
-
-       /**
-        * Inserts mm-relation into a relation table
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The related object
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object
-        * @param string $propertyName The name of the parent object's property where the related objects are stored in
-        * @param int $sortingPosition Defaults to NULL
-        * @return int The uid of the inserted row
-        */
-       protected function insertRelationInRelationtable(Tx_Extbase_DomainObject_DomainObjectInterface $object, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $sortingPosition = NULL) {
-               $dataMap = $this->dataMapper->getDataMap(get_class($parentObject));
-               $columnMap = $dataMap->getColumnMap($propertyName);
-               $row = array(
-                       $columnMap->getParentKeyFieldName() => (int)$parentObject->getUid(),
-                       $columnMap->getChildKeyFieldName() => (int)$object->getUid(),
-                       $columnMap->getChildSortByFieldName() => !is_null($sortingPosition) ? (int)$sortingPosition : 0
-                       );
-               $relationTableName = $columnMap->getRelationTableName();
-               // FIXME Reenable support for tablenames
-               // $childTableName = $columnMap->getChildTableName();
-               // if (isset($childTableName)) {
-               //      $row['tablenames'] = $childTableName;
-               // }
-               if ($columnMap->getRelationTablePageIdColumnName() !== NULL) {
-                       $row[$columnMap->getRelationTablePageIdColumnName()] = $this->determineStoragePageIdForNewRecord();
-               }
-
-               $relationTableInsertFields = $columnMap->getRelationTableInsertFields();
-               if (count($relationTableInsertFields)) {
-                       foreach($relationTableInsertFields as $insertField => $insertValue) {
-                               $row[$insertField] = $insertValue;
-                       }
-               }
-
-               $res = $this->storageBackend->addRow(
-                       $relationTableName,
-                       $row,
-                       TRUE);
-               return $res;
-       }
-
-       /**
-        * Delete all mm-relations of a parent from a relation table
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object
-        * @param string $parentPropertyName The name of the parent object's property where the related objects are stored in
-        * @return bool
-        */
-       protected function deleteAllRelationsFromRelationtable(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $parentPropertyName) {
-               $dataMap = $this->dataMapper->getDataMap(get_class($parentObject));
-               $columnMap = $dataMap->getColumnMap($parentPropertyName);
-               $relationTableName = $columnMap->getRelationTableName();
-
-               $relationMatchFields = array(
-                       $columnMap->getParentKeyFieldName() => (int)$parentObject->getUid()
-               );
-
-               $relationTableMatchFields = $columnMap->getRelationTableMatchFields();
-               if (is_array($relationTableMatchFields) && count($relationTableMatchFields) > 0) {
-                       $relationMatchFields = array_merge($relationTableMatchFields,$relationMatchFields);
-               }
-
-               $res = $this->storageBackend->removeRow(
-                       $relationTableName,
-                       $relationMatchFields,
-                       FALSE);
-               return $res;
-       }
-
-       /**
-        * Delete an mm-relation from a relation table
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $relatedObject The related object
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object
-        * @param string $parentPropertyName The name of the parent object's property where the related objects are stored in
-        * @return bool
-        */
-       protected function deleteRelationFromRelationtable(Tx_Extbase_DomainObject_DomainObjectInterface $relatedObject, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $parentPropertyName) {
-               $dataMap = $this->dataMapper->getDataMap(get_class($parentObject));
-               $columnMap = $dataMap->getColumnMap($parentPropertyName);
-               $relationTableName = $columnMap->getRelationTableName();
-               $res = $this->storageBackend->removeRow(
-                       $relationTableName,
-                       array(
-                               $columnMap->getParentKeyFieldName() => (int)$parentObject->getUid(),
-                               $columnMap->getChildKeyFieldName() => (int)$relatedObject->getUid(),
-                               ),
-                       FALSE);
-               return $res;
-       }
-
-       /**
-        * Updates a given object in the storage
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be updated
-        * @param array $row Row to be stored
-        * @return bool
-        */
-       protected function updateObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, array $row) {
-               $dataMap = $this->dataMapper->getDataMap(get_class($object));
-               $this->addCommonFieldsToRow($object, $row);
-               $row['uid'] = $object->getUid();
-               if($dataMap->getLanguageIdColumnName() !== NULL) {
-                       $row[$dataMap->getLanguageIdColumnName()] = $object->_getProperty('_languageUid');
-                       if ($object->_getProperty('_localizedUid') !== NULL) {
-                               $row['uid'] = $object->_getProperty('_localizedUid');
-                       }
-               }
-               $res = $this->storageBackend->updateRow(
-                       $dataMap->getTableName(),
-                       $row
-                       );
-
-               if ($res === TRUE) {
-                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterUpdateObject', array('object' => $object));
-               }
-
-               $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;
-       }
-
-       /**
-        * Adds common databse fields to a row
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
-        * @param array $row
-        * @return void
-        */
-       protected function addCommonFieldsToRow(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) {
-               $dataMap = $this->dataMapper->getDataMap(get_class($object));
-               $this->addCommonDateFieldsToRow($object, $row);
-               if ($dataMap->getRecordTypeColumnName() !== NULL && $dataMap->getRecordType() !== NULL) {
-                       $row[$dataMap->getRecordTypeColumnName()] = $dataMap->getRecordType();
-               }
-               if ($object->_isNew() && !isset($row['pid'])) {
-                       $row['pid'] = $this->determineStoragePageIdForNewRecord($object);
-               }
-       }
-
-       /**
-        * Adjustes the common date fields of the given row to the current time
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
-        * @param array $row The row to be updated
-        * @return void
-        */
-       protected function addCommonDateFieldsToRow(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) {
-               $dataMap = $this->dataMapper->getDataMap(get_class($object));
-               if ($object->_isNew() && $dataMap->getCreationDateColumnName() !== NULL) {
-                       $row[$dataMap->getCreationDateColumnName()] = $GLOBALS['EXEC_TIME'];
-               }
-               if ($dataMap->getModificationDateColumnName() !== NULL) {
-                       $row[$dataMap->getModificationDateColumnName()] = $GLOBALS['EXEC_TIME'];
-               }
-       }
-
-       /**
-        * Iterate over deleted aggregate root objects and process them
-        *
-        * @return void
-        */
-       protected function processDeletedObjects() {
-               foreach ($this->deletedObjects as $object) {
-                       $this->removeObject($object);
-                       $this->identityMap->unregisterObject($object);
-               }
-               $this->deletedObjects = new Tx_Extbase_Persistence_ObjectStorage();
-       }
-
-       /**
-        * Deletes an object
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be removed from the storage
-        * @param bool $markAsDeleted Wether to just flag the row deleted (default) or really delete it
-        * @return void
-        */
-       protected function removeObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, $markAsDeleted = TRUE) {
-               $dataMap = $this->dataMapper->getDataMap(get_class($object));
-               $tableName = $dataMap->getTableName();
-               if (($markAsDeleted === TRUE) && ($dataMap->getDeletedFlagColumnName() !== NULL)) {
-                       $deletedColumnName = $dataMap->getDeletedFlagColumnName();
-                       $row = array(
-                               'uid' => $object->getUid(),
-                               $deletedColumnName => 1
-                       );
-                       $this->addCommonDateFieldsToRow($object, $row);
-                       $res = $this->storageBackend->updateRow(
-                               $tableName,
-                               $row
-                       );
-               } else {
-                       $res = $this->storageBackend->removeRow(
-                               $tableName,
-                               array('uid' => $object->getUid())
-                               );
-               }
-
-               if ($res === TRUE) {
-                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRemoveObject', array('object' => $object));
-               }
-
-               $this->removeRelatedObjects($object);
-               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
-               if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
-                       $this->referenceIndex->updateRefIndexTable($tableName, $object->getUid());
-               }
-       }
-
-       /**
-        * Remove related objects
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to scanned for related objects
-        * @return void
-        */
-       protected function removeRelatedObjects(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
-               $className = get_class($object);
-               $dataMap = $this->dataMapper->getDataMap($className);
-               $classSchema = $this->reflectionService->getClassSchema($className);
-
-               $properties = $object->_getProperties();
-               foreach ($properties as $propertyName => $propertyValue) {
-                       $columnMap = $dataMap->getColumnMap($propertyName);
-                       $propertyMetaData = $classSchema->getProperty($propertyName);
-                       if ($propertyMetaData['cascade'] === 'remove') {
-                               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
-                                       foreach ($propertyValue as $containedObject) {
-                                               $this->removeObject($containedObject);
-                                       }
-                               } elseif ($propertyValue instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
-                                       $this->removeObject($propertyValue);
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Determine the storage page ID for a given NEW record
-        *
-        * This does the following:
-        * - If the domain object has an accessible property 'pid' (i.e. through a getPid() method), that is used to store the record.
-        * - If there is a TypoScript configuration "classes.CLASSNAME.newRecordStoragePid", that is used to store new records.
-        * - If there is no such TypoScript configuration, it uses the first value of The "storagePid" taken for reading records.
-        *
-        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
-        * @return int the storage Page ID where the object should be stored
-        */
-       protected function determineStoragePageIdForNewRecord(Tx_Extbase_DomainObject_DomainObjectInterface $object = NULL) {
-               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
-               if ($object !== NULL) {
-                       if (Tx_Extbase_Reflection_ObjectAccess::isPropertyGettable($object, 'pid')) {
-                               $pid = Tx_Extbase_Reflection_ObjectAccess::getProperty($object, 'pid');
-                               if (isset($pid)) {
-                                       return (int)$pid;
-                               }
-                       }
-                       $className = get_class($object);
-                       if (isset($frameworkConfiguration['persistence']['classes'][$className]) && !empty($frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'])) {
-                               return (int)$frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'];
-                       }
-               }
-               $storagePidList = t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid']);
-               return (int) $storagePidList[0];
-       }
-
-       /**
-        * Returns a plain value, i.e. objects are flattened out if possible.
-        *
-        * @param mixed $input
-        * @return mixed
-        */
-       protected function getPlainValue($input) {
-               if ($input instanceof DateTime) {
-                       return $input->format('U');
-               } elseif ($input instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
-                       return $input->getUid();
-               } elseif (is_bool($input)) {
-                       return $input === TRUE ? 1 : 0;
-               } else {
-                       return $input;
-               }
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/BackendInterface.php b/typo3/sysext/extbase/Classes/Persistence/BackendInterface.php
deleted file mode 100644 (file)
index 342f150..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * A persistence backend interface
- *
- * @package Extbase
- * @subpackage Persistence
- * @version $Id$
- */
-interface Tx_Extbase_Persistence_BackendInterface {
-
-       /**
-        * Sets the aggregate root objects
-        *
-        * @param Tx_Extbase_Persistence_ObjectStorage $objects
-        * @return void
-        */
-       public function setAggregateRootObjects(Tx_Extbase_Persistence_ObjectStorage $objects);
-
-       /**
-        * Sets the deleted objects
-        *
-        * @param Tx_Extbase_Persistence_ObjectStorage $objects
-        * @return void
-        */
-       public function setDeletedObjects(Tx_Extbase_Persistence_ObjectStorage $objects);
-
-       /**
-        * Commits the current persistence session
-        *
-        * @return void
-        */
-       public function commit();
-
-       /**
-        * Returns the (internal) identifier for the object, if it is known to the
-        * backend. Otherwise NULL is returned.
-        *
-        * @param object $object
-        * @return string The identifier for the object if it is known, or NULL
-        */
-       public function getIdentifierByObject($object);
-
-       /**
-        * Returns the object with the (internal) identifier, if it is known to the
-        * backend. Otherwise NULL is returned.
-        *
-        * @param string $identifier
-        * @param string $className
-        * @return object The object for the identifier if it is known, or NULL
-        */
-       public function getObjectByIdentifier($identifier, $className);
-
-       /**
-        * Checks if the given object has ever been persisted.
-        *
-        * @param object $object The object to check
-        * @return boolean TRUE if the object is new, FALSE if the object exists in the repository
-        */
-       public function isNewObject($object);
-
-       /**
-        * Replaces the given object by the second object.
-        *
-        * This method will unregister the existing object at the identity map and
-        * register the new object instead. The existing object must therefore
-        * already be registered at the identity map which is the case for all
-        * reconstituted objects.
-        *
-        * The new object will be identified by the uuid which formerly belonged
-        * to the existing object. The existing object looses its uuid.
-        *
-        * @param object $existingObject The existing object
-        * @param object $newObject The new object
-        * @return void
-        */
-       public function replaceObject($existingObject, $newObject);
-}
-?>
\ No newline at end of file
index 1302327..202a6a0 100644 (file)
@@ -1,29 +1,16 @@
 <?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!
-***************************************************************/
+/*                                                                        *
+ * This script belongs to the Extbase framework.                          *
+ *                                                                        *
+ * This class is a backport of the corresponding class of FLOW3.          *
+ * All credits go to the v5 team.                                         *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License, either version 3   *
+ * of the License, or (at your option) any later version.                 *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
 
 /**
  * A generic Persistence exception
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/CleanStateNotMemorized.php b/typo3/sysext/extbase/Classes/Persistence/Exception/CleanStateNotMemorized.php
deleted file mode 100644 (file)
index 09dab42..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Invalid Class" exception
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_CleanStateNotMemorized extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
index 0375cb7..6fa3ced 100644 (file)
@@ -1,36 +1,22 @@
 <?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!
-***************************************************************/
+/*                                                                        *
+ * This script belongs to the Extbase framework.                          *
+ *                                                                        *
+ * This class is a backport of the corresponding class of FLOW3.          *
+ * All credits go to the v5 team.                                         *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License, either version 3   *
+ * of the License, or (at your option) any later version.                 *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
 
 /**
  * An "Invalid Object Type" exception
  *
  * @package Extbase
  * @subpackage Persistence\Exception
- * @version $ID:$
  */
 class Tx_Extbase_Persistence_Exception_IllegalObjectType extends Tx_Extbase_Persistence_Exception {
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/InvalidClass.php b/typo3/sysext/extbase/Classes/Persistence/Exception/InvalidClass.php
deleted file mode 100644 (file)
index 13716f0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Invalid Class" exception
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_InvalidClass extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/InvalidNumberOfConstraints.php b/typo3/sysext/extbase/Classes/Persistence/Exception/InvalidNumberOfConstraints.php
deleted file mode 100644 (file)
index bbe5cc8..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Invalid Number of Constraints" exception.
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_InvalidNumberOfConstraints extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/InvalidPropertyType.php b/typo3/sysext/extbase/Classes/Persistence/Exception/InvalidPropertyType.php
deleted file mode 100644 (file)
index aa3ab7c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Invalid Property Type" exception
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_InvalidPropertyType extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/MissingBackend.php b/typo3/sysext/extbase/Classes/Persistence/Exception/MissingBackend.php
deleted file mode 100644 (file)
index e1fa255..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * A "Missing Backend" exception
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_MissingBackend extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/RepositoryException.php b/typo3/sysext/extbase/Classes/Persistence/Exception/RepositoryException.php
deleted file mode 100644 (file)
index 71555e3..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Main exception thrown by classes in this package. May contain an error
- * message and/or another nested exception.
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $Id$
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
- */
-class Tx_Extbase_Persistence_Exception_RepositoryException extends RuntimeException {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/TooDirty.php b/typo3/sysext/extbase/Classes/Persistence/Exception/TooDirty.php
deleted file mode 100644 (file)
index f1bdc24..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * A "Too Dirty" exception
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_TooDirty extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/UnexpectedTypeException.php b/typo3/sysext/extbase/Classes/Persistence/Exception/UnexpectedTypeException.php
deleted file mode 100644 (file)
index 4e591e6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Unexpected Type" exception.
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_UnexpectedTypeException extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
index aec5493..b87c5a4 100644 (file)
@@ -1,36 +1,22 @@
 <?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!
-***************************************************************/
+/*                                                                        *
+ * This script belongs to the Extbase framework.                          *
+ *                                                                        *
+ * This class is a backport of the corresponding class of FLOW3.          *
+ * All credits go to the v5 team.                                         *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License, either version 3   *
+ * of the License, or (at your option) any later version.                 *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
 
 /**
  * An "Unknown Object" exception
  *
  * @package Extbase
  * @subpackage Persistence\Exception
- * @version $ID:$
  */
 class Tx_Extbase_Persistence_Exception_UnknownObject extends Tx_Extbase_Persistence_Exception {
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedMethod.php b/typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedMethod.php
deleted file mode 100644 (file)
index a42a9b4..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Unsupported Method" exception
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_UnsupportedMethod extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedOrder.php b/typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedOrder.php
deleted file mode 100644 (file)
index a473994..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Unsupported Order" exception: The order you specified in the query is not supported by now.
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_UnsupportedOrder extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedRelation.php b/typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedRelation.php
deleted file mode 100644 (file)
index 0b1cd85..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3. 
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * An "Unsupported Order" exception: The order you specified in the query is not supported by now.
- *
- * @package Extbase
- * @subpackage Persistence\Exception
- * @version $ID:$
- */
-class Tx_Extbase_Persistence_Exception_UnsupportedRelation extends Tx_Extbase_Persistence_Exception {
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
new file mode 100644 (file)
index 0000000..efdf029
--- /dev/null
@@ -0,0 +1,910 @@
+<?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 persistence backend. This backend maps objects to the relational model of the storage backend.
+ * It persists all added, removed and changed objects.
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id$
+ */
+class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendInterface, t3lib_Singleton {
+
+       /**
+        * @var Tx_Extbase_Persistence_Session
+        */
+       protected $session;
+
+       /**
+        * @var Tx_Extbase_Persistence_ObjectStorage
+        */
+       protected $aggregateRootObjects;
+
+       /**
+        * @var Tx_Extbase_Persistence_ObjectStorage
+        */
+       protected $visitedDuringPersistence;
+
+       /**
+        * @var Tx_Extbase_Persistence_IdentityMap
+        **/
+       protected $identityMap;
+
+       /**
+        * @var Tx_Extbase_Reflection_Service
+        */
+       protected $reflectionService;
+
+       /**
+        * @var Tx_Extbase_Persistence_QueryFactoryInterface
+        */
+       protected $queryFactory;
+
+       /**
+        * @var Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
+        */
+       protected $qomFactory;
+
+       /**
+        * @var Tx_Extbase_Persistence_Storage_BackendInterface
+        */
+       protected $storageBackend;
+
+       /**
+        * @var Tx_Extbase_Persistence_Mapper_DataMapper
+        */
+       protected $dataMapper;
+
+       /**
+        * The TYPO3 reference index object
+        *
+        * @var t3lib_refindex
+        **/
+       protected $referenceIndex;
+
+       /**
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
+        */
+       protected $configurationManager;
+
+       /**
+        * @var Tx_Extbase_SignalSlot_Dispatcher
+        */
+       protected $signalSlotDispatcher;
+
+       /**
+        * Constructs the backend
+        *
+        * @return void
+        */
+       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');
+               }
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_Session $session
+        * @return void
+        */
+       public function injectSession(Tx_Extbase_Persistence_Session $session) {
+               $this->session = $session;
+       }
+
+       /**
+        * @param Tx_Extbase_Persistence_Storage_BackendInterface $storageBackend
+        * @return void
+        */
+       public function injectStorageBackend(Tx_Extbase_Persistence_Storage_BackendInterface $storageBackend) {
+               $this->storageBackend = $storageBackend;
+       }
+
+       /**
+        * Injects the DataMapper to map nodes to objects
+        *
+        * @param Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper
+        * @return void
+        */
+       public function injectDataMapper(Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper) {
+               $this->dataMapper = $dataMapper;
+       }
+
+       /**
+        * Injects the identity map
+        *
+        * @param Tx_Extbase_Persistence_IdentityMap $identityMap
+        * @return void
+        */
+       public function injectIdentityMap(Tx_Extbase_Persistence_IdentityMap $identityMap) {
+               $this->identityMap = $identityMap;
+       }
+
+       /**
+        * Injects the Reflection Service
+        *
+        * @param Tx_Extbase_Reflection_Service
+        * @return void
+        */
+       public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
+               $this->reflectionService = $reflectionService;
+       }
+
+       /**
+        * Injects the QueryFactory
+        *
+        * @param Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory
+        * @return void
+        */
+       public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory) {
+               $this->queryFactory = $queryFactory;
+       }
+
+       /**
+        * Injects the QueryObjectModelFactory
+        *
+        * @param Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory
+        * @return void
+        */
+       public function injectQomFactory(Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory) {
+               $this->qomFactory = $qomFactory;
+       }
+
+       /**
+        * @param Tx_Extbase_SignalSlot_Dispatcher $signalSlotDispatcher
+        */
+       public function injectSignalSlotDispatcher(Tx_Extbase_SignalSlot_Dispatcher $signalSlotDispatcher) {
+               $this->signalSlotDispatcher = $signalSlotDispatcher;
+       }
+
+       /**
+        * Returns the repository session
+        *
+        * @return Tx_Extbase_Persistence_Session
+        */
+       public function getSession() {
+               return $this->session;
+       }
+
+       /**
+        * Returns the Data Mapper
+        *
+        * @return Tx_Extbase_Persistence_Mapper_DataMapper
+        */
+       public function getDataMapper() {
+               return $this->dataMapper;
+       }
+
+       /**
+        * Returns the current QOM factory
+        *
+        * @return Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
+        */
+       public function getQomFactory() {
+               return $this->qomFactory;
+       }
+
+       /**
+        * Returns the current identityMap
+        *
+        * @return Tx_Extbase_Persistence_IdentityMap
+        */
+       public function getIdentityMap() {
+               return $this->identityMap;
+       }
+
+       /**
+        * Returns the reflection service
+        *
+        * @return Tx_Extbase_Reflection_Service
+        */
+       public function getReflectionService() {
+               return $this->reflectionService;
+       }
+
+       /**
+        * Returns the number of records matching the query.
+        *
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @return integer
+        * @api
+        */
+       public function getObjectCountByQuery(Tx_Extbase_Persistence_QueryInterface $query) {
+               return $this->storageBackend->getObjectCountByQuery($query);
+       }
+
+       /**
+        * Returns the object data matching the $query.
+        *
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @return array
+        * @api
+        */
+       public function getObjectDataByQuery(Tx_Extbase_Persistence_QueryInterface $query) {
+               return $this->storageBackend->getObjectDataByQuery($query);
+       }
+
+       /**
+        * Returns the (internal) identifier for the object, if it is known to the
+        * backend. Otherwise NULL is returned.
+        *
+        * @param object $object
+        * @return string The identifier for the object if it is known, or NULL
+        */
+       public function getIdentifierByObject($object) {
+               if ($object instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
+                       $object = $object->_loadRealInstance();
+                       if (!is_object($object)) {
+                               return NULL;
+                       }
+               }
+               if ($this->identityMap->hasObject($object)) {
+                       return $this->identityMap->getIdentifierByObject($object);
+               } else {
+                       return NULL;
+               }
+       }
+
+       /**
+        * Returns the object with the (internal) identifier, if it is known to the
+        * backend. Otherwise NULL is returned.
+        *
+        * @param string $identifier
+        * @param string $className
+        * @return object The object for the identifier if it is known, or NULL
+        */
+       public function getObjectByIdentifier($identifier, $className) {
+               if ($this->identityMap->hasIdentifier($identifier, $className)) {
+                       return $this->identityMap->getObjectByIdentifier($identifier, $className);
+               } else {
+                       $query = $this->queryFactory->create($className);
+                       $query->getQuerySettings()->setRespectStoragePage(FALSE);
+
+                       return $query->matching(
+                               $query->equals('uid', $identifier))
+                               ->execute()
+                               ->getFirst();
+               }
+       }
+
+       /**
+        * Checks if the given object has ever been persisted.
+        *
+        * @param object $object The object to check
+        * @return boolean TRUE if the object is new, FALSE if the object exists in the repository
+        */
+       public function isNewObject($object) {
+               return ($this->getIdentifierByObject($object) === NULL);
+       }
+
+       /**
+        * Replaces the given object by the second object.
+        *
+        * This method will unregister the existing object at the identity map and
+        * register the new object instead. The existing object must therefore
+        * already be registered at the identity map which is the case for all
+        * reconstituted objects.
+        *
+        * The new object will be identified by the uid which formerly belonged
+        * to the existing object. The existing object looses its uid.
+        *
+        * @param object $existingObject The existing object
+        * @param object $newObject The new object
+        * @return void
+        */
+       public function replaceObject($existingObject, $newObject) {
+               $existingUid = $this->getIdentifierByObject($existingObject);
+               if ($existingUid === NULL) throw new Tx_Extbase_Persistence_Exception_UnknownObject('The given object is unknown to this persistence backend.', 1238070163);
+
+               $this->identityMap->unregisterObject($existingObject);
+               $this->identityMap->registerObject($newObject, $existingUid);
+       }
+
+       /**
+        * Sets the aggregate root objects
+        *
+        * @param Tx_Extbase_Persistence_ObjectStorage $objects
+        * @return void
+        */
+       public function setAggregateRootObjects(Tx_Extbase_Persistence_ObjectStorage $objects) {
+               $this->aggregateRootObjects = $objects;
+       }
+
+       /**
+        * Sets the deleted objects
+        *
+        * @param Tx_Extbase_Persistence_ObjectStorage $objects
+        * @return void
+        */
+       public function setDeletedObjects(Tx_Extbase_Persistence_ObjectStorage $objects) {
+               $this->deletedObjects = $objects;
+       }
+
+       /**
+        * Commits the current persistence session.
+        *
+        * @return void
+        */
+       public function commit() {
+               $this->persistObjects();
+               $this->processDeletedObjects();
+       }
+
+       /**
+        * Traverse and persist all aggregate roots and their object graph.
+        *
+        * @return void
+        */
+       protected function persistObjects() {
+               $this->visitedDuringPersistence = new Tx_Extbase_Persistence_ObjectStorage();
+               foreach ($this->aggregateRootObjects as $object) {
+                       if (!$this->identityMap->hasObject($object)) {
+                               $this->insertObject($object);
+                       }
+               }
+               foreach ($this->aggregateRootObjects as $object) {
+                       $this->persistObject($object);
+               }
+       }
+
+       /**
+        * Persists the given object.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be inserted
+        * @return void
+        */
+       protected function persistObject(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
+               if (isset($this->visitedDuringPersistence[$object])) {
+                       return;
+               }
+               $row = array();
+               $queue = array();
+               $dataMap = $this->dataMapper->getDataMap(get_class($object));
+               $properties = $object->_getProperties();
+               foreach ($properties as $propertyName => $propertyValue) {
+                       if (!$dataMap->isPersistableProperty($propertyName) || $this->propertyValueIsLazyLoaded($propertyValue)) continue;
+                       $columnMap = $dataMap->getColumnMap($propertyName);
+                       if ($propertyValue instanceof Tx_Extbase_Persistence_ObjectStorage) {
+                               if ($object->_isNew() || $propertyValue->_isDirty()) {
+                                       $this->persistObjectStorage($propertyValue, $object, $propertyName, $row);
+                               }
+                               foreach ($propertyValue as $containedObject) {
+                                       if ($containedObject instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
+                                               $queue[] = $containedObject;
+                                       }
+                               }
+                       } elseif ($propertyValue instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
+                               if ($object->_isDirty($propertyName)) {
+                                       if ($propertyValue->_isNew()) {
+                                               $this->insertObject($propertyValue);
+                                       }
+                                       $row[$columnMap->getColumnName()] = $this->getPlainValue($propertyValue);
+                               }
+                               $queue[] = $propertyValue;
+                       } elseif ($object->_isNew() || $object->_isDirty($propertyName)) {
+                               $row[$columnMap->getColumnName()] = $this->getPlainValue($propertyValue);
+                       }
+               }
+               if (count($row) > 0) {
+                       $this->updateObject($object, $row);
+                       $object->_memorizeCleanState();
+               }
+               $this->visitedDuringPersistence[$object] = $object->getUid();
+               foreach ($queue as $queuedObject) {
+                       $this->persistObject($queuedObject);
+               }
+       }
+
+       /**
+        * Checks, if the property value is lazy loaded and was not initialized
+        *
+        * @param mixed $propertyValue The property value
+        * @return bool
+        */
+       protected function propertyValueIsLazyLoaded($propertyValue) {
+               if ($propertyValue instanceof Tx_Extbase_Persistence_LazyLoadingProxy) return TRUE;
+               if ($propertyValue instanceof Tx_Extbase_Persistence_LazyObjectStorage) {
+                       if ($propertyValue->isInitialized() === FALSE) {
+                               return TRUE;
+                       }
+               }
+               return FALSE;
+       }
+
+       /**
+        * Persists a an object storage. Objects of a 1:n or m:n relation are queued and processed with the parent object. A 1:1 relation
+        * gets persisted immediately. Objects which were removed from the property were detached from the parent object. They will not be
+        * deleted by default. You have to annotate the property with "@cascade remove" if you want them to be deleted as well.
+        *
+        * @param Tx_Extbase_Persistence_ObjectStorage $objectStorage The object storage to be persisted.
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object. One of the properties holds the object storage.
+        * @param string $propertyName The name of the property holding the object storage.
+        * @param array $row The row array of the parent object to be persisted. It's passed by reference and gets filled with either a comma separated list of uids (csv) or the number of contained objects.
+        * @return void
+        */
+       protected function persistObjectStorage(Tx_Extbase_Persistence_ObjectStorage $objectStorage, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, array &$row) {
+               $className = get_class($parentObject);
+               $columnMap = $this->dataMapper->getDataMap($className)->getColumnMap($propertyName);
+               $columnName = $columnMap->getColumnName();
+               $propertyMetaData = $this->reflectionService->getClassSchema($className)->getProperty($propertyName);
+
+               foreach ($this->getRemovedChildObjects($parentObject, $propertyName) as $removedObject) {
+                       if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY && $propertyMetaData['cascade'] === 'remove') {
+                               $this->removeObject($removedObject);
+                       } else {
+                               $this->detachObjectFromParentObject($removedObject, $parentObject, $propertyName);
+                       }
+               }
+
+               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+                       $this->deleteAllRelationsFromRelationtable($parentObject, $propertyName);
+               }
+
+               $currentUids = array();
+               $sortingPosition = 1;
+               foreach ($objectStorage as $object) {
+                       if ($object->_isNew()) {
+                               $this->insertObject($object);
+                       }
+                       $currentUids[] = $object->getUid();
+                       $this->attachObjectToParentObject($object, $parentObject, $propertyName, $sortingPosition);
+                       $sortingPosition++;
+               }
+
+               if ($columnMap->getParentKeyFieldName() === NULL) {
+                       $row[$columnMap->getColumnName()] = implode(',', $currentUids);
+               } else {
+                       $row[$columnMap->getColumnName()] = $this->dataMapper->countRelated($parentObject, $propertyName);
+               }
+       }
+
+       /**
+        * Returns the removed objects determined by a comparison of the clean property value
+        * with the actual property value.
+        *
+        * @param Tx_Extbase_DomainObject_AbstractEntity $object The object
+        * @param string $parentPropertyName The name of the property
+        * @return array An array of removed objects
+        */
+       protected function getRemovedChildObjects(Tx_Extbase_DomainObject_AbstractEntity $object, $propertyName) {
+               $removedObjects = array();
+               $cleanPropertyValue = $object->_getCleanProperty($propertyName);
+               if (is_array($cleanPropertyValue) || $cleanPropertyValue instanceof Iterator) {
+                       $propertyValue = $object->_getProperty($propertyName);
+                       foreach ($cleanPropertyValue as $containedObject) {
+                               if (!$propertyValue->contains($containedObject)) {
+                                       $removedObjects[] = $containedObject;
+                               }
+                       }
+               }
+               return $removedObjects;
+       }
+
+       /**
+        * Updates the fields defining the relation between the object and the parent object.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
+        * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject
+        * @param string $parentPropertyName
+        * @return void
+        */
+       protected function attachObjectToParentObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, Tx_Extbase_DomainObject_AbstractEntity $parentObject, $parentPropertyName, $sortingPosition = 0) {
+               $parentDataMap = $this->dataMapper->getDataMap(get_class($parentObject));
+               $parentColumnMap = $parentDataMap->getColumnMap($parentPropertyName);
+               if ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
+                       $row = array();
+                       $parentKeyFieldName = $parentColumnMap->getParentKeyFieldName();
+                       if ($parentKeyFieldName !== NULL) {
+                               $row[$parentKeyFieldName] = $parentObject->getUid();
+                               $parentTableFieldName = $parentColumnMap->getParentTableFieldName();
+                               if ($parentTableFieldName !== NULL) {
+                                       $row[$parentTableFieldName] = $parentDataMap->getTableName();
+                               }
+                       }
+                       $childSortByFieldName = $parentColumnMap->getChildSortByFieldName();
+                       if (!empty($childSortByFieldName)) {
+                               $row[$childSortByFieldName] = $sortingPosition;
+                       }
+                       if (count($row) > 0) {
+                               $this->updateObject($object, $row);
+                       }
+               } elseif ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+                       $this->insertRelationInRelationtable($object, $parentObject, $parentPropertyName, $sortingPosition);
+               }
+       }
+
+       /**
+        * Updates the fields defining the relation between the object and the parent object.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
+        * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject
+        * @param string $parentPropertyName
+        * @return void
+        */
+       protected function detachObjectFromParentObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, Tx_Extbase_DomainObject_AbstractEntity $parentObject, $parentPropertyName) {
+               $parentDataMap = $this->dataMapper->getDataMap(get_class($parentObject));
+               $parentColumnMap = $parentDataMap->getColumnMap($parentPropertyName);
+               if ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
+                       $row = array();
+                       $parentKeyFieldName = $parentColumnMap->getParentKeyFieldName();
+                       if ($parentKeyFieldName !== NULL) {
+                               $row[$parentKeyFieldName] = '';
+                               $parentTableFieldName = $parentColumnMap->getParentTableFieldName();
+                               if ($parentTableFieldName !== NULL) {
+                                       $row[$parentTableFieldName] = '';
+                               }
+                       }
+                       $childSortByFieldName = $parentColumnMap->getChildSortByFieldName();
+                       if (!empty($childSortByFieldName)) {
+                               $row[$childSortByFieldName] = 0;
+                       }
+                       if (count($row) > 0) {
+                               $this->updateObject($object, $row);
+                       }
+               } elseif ($parentColumnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+                       $this->deleteRelationFromRelationtable($object, $parentObject, $parentPropertyName);
+               }
+       }
+
+       /**
+        * Inserts an object in the storage backend
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be insterted in the storage
+        * @return void
+        */
+       protected function insertObject(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
+               if ($object instanceof Tx_Extbase_DomainObject_AbstractValueObject) {
+                       $result = $this->getUidOfAlreadyPersistedValueObject($object);
+                       if ($result !== FALSE) {
+                               $object->_setProperty('uid', (int)$result);
+                               return;
+                       }
+               }
+
+               $dataMap = $this->dataMapper->getDataMap(get_class($object));
+               $row = array();
+               $this->addCommonFieldsToRow($object, $row);
+               if($dataMap->getLanguageIdColumnName() !== NULL) {
+                       $row[$dataMap->getLanguageIdColumnName()] = -1;
+               }
+               $uid = $this->storageBackend->addRow(
+                       $dataMap->getTableName(),
+                       $row
+                       );
+               $object->_setProperty('uid', (int)$uid);
+
+               if ((integer)$uid >= 1) {
+                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterInsertObject', array('object' => $object));
+               }
+
+               $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);
+       }
+
+       /**
+        * Tests, if the given Value Object already exists in the storage backend and if so, it returns the uid.
+        *
+        * @param Tx_Extbase_DomainObject_AbstractValueObject $object The object to be tested
+        * @return mixed The matching uid if an object was found, else FALSE
+        */
+       protected function getUidOfAlreadyPersistedValueObject(Tx_Extbase_DomainObject_AbstractValueObject $object) {
+               return $this->storageBackend->getUidOfAlreadyPersistedValueObject($object);
+       }
+
+       /**
+        * Inserts mm-relation into a relation table
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The related object
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object
+        * @param string $propertyName The name of the parent object's property where the related objects are stored in
+        * @param int $sortingPosition Defaults to NULL
+        * @return int The uid of the inserted row
+        */
+       protected function insertRelationInRelationtable(Tx_Extbase_DomainObject_DomainObjectInterface $object, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $sortingPosition = NULL) {
+               $dataMap = $this->dataMapper->getDataMap(get_class($parentObject));
+               $columnMap = $dataMap->getColumnMap($propertyName);
+               $row = array(
+                       $columnMap->getParentKeyFieldName() => (int)$parentObject->getUid(),
+                       $columnMap->getChildKeyFieldName() => (int)$object->getUid(),
+                       $columnMap->getChildSortByFieldName() => !is_null($sortingPosition) ? (int)$sortingPosition : 0
+                       );
+               $relationTableName = $columnMap->getRelationTableName();
+               // FIXME Reenable support for tablenames
+               // $childTableName = $columnMap->getChildTableName();
+               // if (isset($childTableName)) {
+               //      $row['tablenames'] = $childTableName;
+               // }
+               if ($columnMap->getRelationTablePageIdColumnName() !== NULL) {
+                       $row[$columnMap->getRelationTablePageIdColumnName()] = $this->determineStoragePageIdForNewRecord();
+               }
+
+               $relationTableInsertFields = $columnMap->getRelationTableInsertFields();
+               if (count($relationTableInsertFields)) {
+                       foreach($relationTableInsertFields as $insertField => $insertValue) {
+                               $row[$insertField] = $insertValue;
+                       }
+               }
+
+               $res = $this->storageBackend->addRow(
+                       $relationTableName,
+                       $row,
+                       TRUE);
+               return $res;
+       }
+
+       /**
+        * Delete all mm-relations of a parent from a relation table
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object
+        * @param string $parentPropertyName The name of the parent object's property where the related objects are stored in
+        * @return bool
+        */
+       protected function deleteAllRelationsFromRelationtable(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $parentPropertyName) {
+               $dataMap = $this->dataMapper->getDataMap(get_class($parentObject));
+               $columnMap = $dataMap->getColumnMap($parentPropertyName);
+               $relationTableName = $columnMap->getRelationTableName();
+
+               $relationMatchFields = array(
+                       $columnMap->getParentKeyFieldName() => (int)$parentObject->getUid()
+               );
+
+               $relationTableMatchFields = $columnMap->getRelationTableMatchFields();
+               if (is_array($relationTableMatchFields) && count($relationTableMatchFields) > 0) {
+                       $relationMatchFields = array_merge($relationTableMatchFields,$relationMatchFields);
+               }
+
+               $res = $this->storageBackend->removeRow(
+                       $relationTableName,
+                       $relationMatchFields,
+                       FALSE);
+               return $res;
+       }
+
+       /**
+        * Delete an mm-relation from a relation table
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $relatedObject The related object
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object
+        * @param string $parentPropertyName The name of the parent object's property where the related objects are stored in
+        * @return bool
+        */
+       protected function deleteRelationFromRelationtable(Tx_Extbase_DomainObject_DomainObjectInterface $relatedObject, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $parentPropertyName) {
+               $dataMap = $this->dataMapper->getDataMap(get_class($parentObject));
+               $columnMap = $dataMap->getColumnMap($parentPropertyName);
+               $relationTableName = $columnMap->getRelationTableName();
+               $res = $this->storageBackend->removeRow(
+                       $relationTableName,
+                       array(
+                               $columnMap->getParentKeyFieldName() => (int)$parentObject->getUid(),
+                               $columnMap->getChildKeyFieldName() => (int)$relatedObject->getUid(),
+                               ),
+                       FALSE);
+               return $res;
+       }
+
+       /**
+        * Updates a given object in the storage
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be updated
+        * @param array $row Row to be stored
+        * @return bool
+        */
+       protected function updateObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, array $row) {
+               $dataMap = $this->dataMapper->getDataMap(get_class($object));
+               $this->addCommonFieldsToRow($object, $row);
+               $row['uid'] = $object->getUid();
+               if($dataMap->getLanguageIdColumnName() !== NULL) {
+                       $row[$dataMap->getLanguageIdColumnName()] = $object->_getProperty('_languageUid');
+                       if ($object->_getProperty('_localizedUid') !== NULL) {
+                               $row['uid'] = $object->_getProperty('_localizedUid');
+                       }
+               }
+               $res = $this->storageBackend->updateRow(
+                       $dataMap->getTableName(),
+                       $row
+                       );
+
+               if ($res === TRUE) {
+                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterUpdateObject', array('object' => $object));
+               }
+
+               $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;
+       }
+
+       /**
+        * Adds common databse fields to a row
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
+        * @param array $row
+        * @return void
+        */
+       protected function addCommonFieldsToRow(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) {
+               $dataMap = $this->dataMapper->getDataMap(get_class($object));
+               $this->addCommonDateFieldsToRow($object, $row);
+               if ($dataMap->getRecordTypeColumnName() !== NULL && $dataMap->getRecordType() !== NULL) {
+                       $row[$dataMap->getRecordTypeColumnName()] = $dataMap->getRecordType();
+               }
+               if ($object->_isNew() && !isset($row['pid'])) {
+                       $row['pid'] = $this->determineStoragePageIdForNewRecord($object);
+               }
+       }
+
+       /**
+        * Adjustes the common date fields of the given row to the current time
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
+        * @param array $row The row to be updated
+        * @return void
+        */
+       protected function addCommonDateFieldsToRow(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) {
+               $dataMap = $this->dataMapper->getDataMap(get_class($object));
+               if ($object->_isNew() && $dataMap->getCreationDateColumnName() !== NULL) {
+                       $row[$dataMap->getCreationDateColumnName()] = $GLOBALS['EXEC_TIME'];
+               }
+               if ($dataMap->getModificationDateColumnName() !== NULL) {
+                       $row[$dataMap->getModificationDateColumnName()] = $GLOBALS['EXEC_TIME'];
+               }
+       }
+
+       /**
+        * Iterate over deleted aggregate root objects and process them
+        *
+        * @return void
+        */
+       protected function processDeletedObjects() {
+               foreach ($this->deletedObjects as $object) {
+                       $this->removeObject($object);
+                       $this->identityMap->unregisterObject($object);
+               }
+               $this->deletedObjects = new Tx_Extbase_Persistence_ObjectStorage();
+       }
+
+       /**
+        * Deletes an object
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to be removed from the storage
+        * @param bool $markAsDeleted Wether to just flag the row deleted (default) or really delete it
+        * @return void
+        */
+       protected function removeObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, $markAsDeleted = TRUE) {
+               $dataMap = $this->dataMapper->getDataMap(get_class($object));
+               $tableName = $dataMap->getTableName();
+               if (($markAsDeleted === TRUE) && ($dataMap->getDeletedFlagColumnName() !== NULL)) {
+                       $deletedColumnName = $dataMap->getDeletedFlagColumnName();
+                       $row = array(
+                               'uid' => $object->getUid(),
+                               $deletedColumnName => 1
+                       );
+                       $this->addCommonDateFieldsToRow($object, $row);
+                       $res = $this->storageBackend->updateRow(
+                               $tableName,
+                               $row
+                       );
+               } else {
+                       $res = $this->storageBackend->removeRow(
+                               $tableName,
+                               array('uid' => $object->getUid())
+                               );
+               }
+
+               if ($res === TRUE) {
+                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRemoveObject', array('object' => $object));
+               }
+
+               $this->removeRelatedObjects($object);
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
+                       $this->referenceIndex->updateRefIndexTable($tableName, $object->getUid());
+               }
+       }
+
+       /**
+        * Remove related objects
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to scanned for related objects
+        * @return void
+        */
+       protected function removeRelatedObjects(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
+               $className = get_class($object);
+               $dataMap = $this->dataMapper->getDataMap($className);
+               $classSchema = $this->reflectionService->getClassSchema($className);
+
+               $properties = $object->_getProperties();
+               foreach ($properties as $propertyName => $propertyValue) {
+                       $columnMap = $dataMap->getColumnMap($propertyName);
+                       $propertyMetaData = $classSchema->getProperty($propertyName);
+                       if ($propertyMetaData['cascade'] === 'remove') {
+                               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
+                                       foreach ($propertyValue as $containedObject) {
+                                               $this->removeObject($containedObject);
+                                       }
+                               } elseif ($propertyValue instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
+                                       $this->removeObject($propertyValue);
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Determine the storage page ID for a given NEW record
+        *
+        * This does the following:
+        * - If the domain object has an accessible property 'pid' (i.e. through a getPid() method), that is used to store the record.
+        * - If there is a TypoScript configuration "classes.CLASSNAME.newRecordStoragePid", that is used to store new records.
+        * - If there is no such TypoScript configuration, it uses the first value of The "storagePid" taken for reading records.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
+        * @return int the storage Page ID where the object should be stored
+        */
+       protected function determineStoragePageIdForNewRecord(Tx_Extbase_DomainObject_DomainObjectInterface $object = NULL) {
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               if ($object !== NULL) {
+                       if (Tx_Extbase_Reflection_ObjectAccess::isPropertyGettable($object, 'pid')) {
+                               $pid = Tx_Extbase_Reflection_ObjectAccess::getProperty($object, 'pid');
+                               if (isset($pid)) {
+                                       return (int)$pid;
+                               }
+                       }
+                       $className = get_class($object);
+                       if (isset($frameworkConfiguration['persistence']['classes'][$className]) && !empty($frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'])) {
+                               return (int)$frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'];
+                       }
+               }
+               $storagePidList = t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid']);
+               return (int) $storagePidList[0];
+       }
+
+       /**
+        * Returns a plain value, i.e. objects are flattened out if possible.
+        *
+        * @param mixed $input
+        * @return mixed
+        */
+       protected function getPlainValue($input) {
+               if ($input instanceof DateTime) {
+                       return $input->format('U');
+               } elseif ($input instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
+                       return $input->getUid();
+               } elseif (is_bool($input)) {
+                       return $input === TRUE ? 1 : 0;
+               } else {
+                       return $input;
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/BackendInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/BackendInterface.php
new file mode 100644 (file)
index 0000000..342f150
--- /dev/null
@@ -0,0 +1,104 @@
+<?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 persistence backend interface
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id$
+ */
+interface Tx_Extbase_Persistence_BackendInterface {
+
+       /**
+        * Sets the aggregate root objects
+        *
+        * @param Tx_Extbase_Persistence_ObjectStorage $objects
+        * @return void
+        */
+       public function setAggregateRootObjects(Tx_Extbase_Persistence_ObjectStorage $objects);
+
+       /**
+        * Sets the deleted objects
+        *
+        * @param Tx_Extbase_Persistence_ObjectStorage $objects
+        * @return void
+        */
+       public function setDeletedObjects(Tx_Extbase_Persistence_ObjectStorage $objects);
+
+       /**
+        * Commits the current persistence session
+        *
+        * @return void
+        */
+       public function commit();
+
+       /**
+        * Returns the (internal) identifier for the object, if it is known to the
+        * backend. Otherwise NULL is returned.
+        *
+        * @param object $object
+        * @return string The identifier for the object if it is known, or NULL
+        */
+       public function getIdentifierByObject($object);
+
+       /**
+        * Returns the object with the (internal) identifier, if it is known to the
+        * backend. Otherwise NULL is returned.
+        *
+        * @param string $identifier
+        * @param string $className
+        * @return object The object for the identifier if it is known, or NULL
+        */
+       public function getObjectByIdentifier($identifier, $className);
+
+       /**
+        * Checks if the given object has ever been persisted.
+        *
+        * @param object $object The object to check
+        * @return boolean TRUE if the object is new, FALSE if the object exists in the repository
+        */
+       public function isNewObject($object);
+
+       /**
+        * Replaces the given object by the second object.
+        *
+        * This method will unregister the existing object at the identity map and
+        * register the new object instead. The existing object must therefore
+        * already be registered at the identity map which is the case for all
+        * reconstituted objects.
+        *
+        * The new object will be identified by the uuid which formerly belonged
+        * to the existing object. The existing object looses its uuid.
+        *
+        * @param object $existingObject The existing object
+        * @param object $newObject The new object
+        * @return void
+        */
+       public function replaceObject($existingObject, $newObject);
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/CleanStateNotMemorized.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/CleanStateNotMemorized.php
new file mode 100644 (file)
index 0000000..09dab42
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Invalid Class" exception
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_CleanStateNotMemorized extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidClass.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidClass.php
new file mode 100644 (file)
index 0000000..13716f0
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Invalid Class" exception
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_InvalidClass extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidNumberOfConstraints.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidNumberOfConstraints.php
new file mode 100644 (file)
index 0000000..bbe5cc8
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Invalid Number of Constraints" exception.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_InvalidNumberOfConstraints extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidPropertyType.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/InvalidPropertyType.php
new file mode 100644 (file)
index 0000000..aa3ab7c
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Invalid Property Type" exception
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_InvalidPropertyType extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/MissingBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/MissingBackend.php
new file mode 100644 (file)
index 0000000..e1fa255
--- /dev/null
@@ -0,0 +1,38 @@
+<?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 "Missing Backend" exception
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_MissingBackend extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/RepositoryException.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/RepositoryException.php
new file mode 100644 (file)
index 0000000..71555e3
--- /dev/null
@@ -0,0 +1,40 @@
+<?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!
+***************************************************************/
+
+/**
+ * Main exception thrown by classes in this package. May contain an error
+ * message and/or another nested exception.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $Id$
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class Tx_Extbase_Persistence_Exception_RepositoryException extends RuntimeException {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/TooDirty.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/TooDirty.php
new file mode 100644 (file)
index 0000000..f1bdc24
--- /dev/null
@@ -0,0 +1,38 @@
+<?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 "Too Dirty" exception
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_TooDirty extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnexpectedTypeException.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnexpectedTypeException.php
new file mode 100644 (file)
index 0000000..4e591e6
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Unexpected Type" exception.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_UnexpectedTypeException extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedMethod.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedMethod.php
new file mode 100644 (file)
index 0000000..a42a9b4
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Unsupported Method" exception
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_UnsupportedMethod extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedOrder.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedOrder.php
new file mode 100644 (file)
index 0000000..a473994
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Unsupported Order" exception: The order you specified in the query is not supported by now.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_UnsupportedOrder extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedRelation.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/UnsupportedRelation.php
new file mode 100644 (file)
index 0000000..0b1cd85
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+***************************************************************/
+
+/**
+ * An "Unsupported Order" exception: The order you specified in the query is not supported by now.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Exception
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Exception_UnsupportedRelation extends Tx_Extbase_Persistence_Exception {
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/IdentityMap.php b/typo3/sysext/extbase/Classes/Persistence/Generic/IdentityMap.php
new file mode 100644 (file)
index 0000000..716156c
--- /dev/null
@@ -0,0 +1,133 @@
+<?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!
+***************************************************************/
+
+/**
+ * An identity mapper to map nodes to objects
+ *
+ * @version $Id$
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @see Tx_Extbase_Persistence_Mapper_DataMapper , Tx_Extbase_Persistence_Backend
+ */
+class Tx_Extbase_Persistence_IdentityMap implements t3lib_Singleton {
+
+       /**
+        * @var Tx_Extbase_Persistence_ObjectStorage
+        */
+       protected $objectMap;
+
+       /**
+        * @var array
+        */
+       protected $uuidMap = array();
+
+       /**
+        * Constructs a new Identity Map
+        *
+        * @author Karsten Dambekalns <karsten@typo3.org>
+        */
+       public function __construct() {
+               $this->objectMap = new Tx_Extbase_Persistence_ObjectStorage();
+       }
+
+       /**
+        * Checks whether the given object is known to the identity map
+        *
+        * @param object $object
+        * @return boolean
+        * @author Karsten Dambekalns <karsten@typo3.org>
+        */
+       public function hasObject($object) {
+               return $this->objectMap->contains($object);
+       }
+
+       /**
+        * Checks whether the given UUID is known to the identity map
+        *
+        * @param string $uuid
+        * @param string $className
+        * @return boolean
+        */
+       public function hasIdentifier($uuid, $className) {
+               if (is_array($this->uuidMap[$className])) {
+                       return array_key_exists($uuid, $this->uuidMap[$className]);
+               } else {
+                       return FALSE;
+               }
+       }
+
+       /**
+        * Returns the object for the given UUID
+        *
+        * @param string $uuid
+        * @param string $className
+        * @return object
+        */
+       public function getObjectByIdentifier($uuid, $className) {
+               return $this->uuidMap[$className][$uuid];
+       }
+
+       /**
+        * Returns the node identifier for the given object
+        *
+        * @param object $object
+        * @return string
+        * @author Karsten Dambekalns <karsten@typo3.org>
+        */
+       public function getIdentifierByObject($object) {
+               if (!is_object($object)) throw new InvalidArgumentException('Object expected, ' . gettype($object) . ' given.', 1246892972);
+               if (!isset($this->objectMap[$object])) {
+                       throw new Tx_Extbase_Persistence_Exception_UnknownObject('The given object (class: ' . get_class($object) . ') is not registered in this Identity Map.', 1246892970);
+               }
+               return $this->objectMap[$object];
+       }
+
+       /**
+        * Register a node identifier for an object
+        *
+        * @param object $object
+        * @param string $uuid
+        * @author Karsten Dambekalns <karsten@typo3.org>
+        */
+       public function registerObject($object, $uuid) {
+               $this->objectMap[$object] = $uuid;
+               $this->uuidMap[get_class($object)][$uuid] = $object;
+       }
+
+       /**
+        * Unregister an object
+        *
+        * @param string $object
+        * @return void
+        * @author Karsten Dambekalns <karsten@typo3.org>
+        */
+       public function unregisterObject($object) {
+               unset($this->uuidMap[get_class($object)][$this->objectMap[$object]]);
+               $this->objectMap->detach($object);
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php
new file mode 100644 (file)
index 0000000..6c699d7
--- /dev/null
@@ -0,0 +1,230 @@
+<?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 proxy that can replace any object and replaces itself in it's parent on
+ * first access (call, get, set, isset, unset).
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id$
+ */
+class Tx_Extbase_Persistence_LazyLoadingProxy implements Iterator, Tx_Extbase_Persistence_LoadingStrategyInterface {
+
+       /**
+        * @var Tx_Extbase_Persistence_Mapper_DataMapper
+        */
+       protected $dataMapper;
+
+       /**
+        * The object this property is contained in.
+        *
+        * @var object
+        */
+       private $parentObject;
+
+       /**
+        * The name of the property represented by this proxy.
+        *
+        * @var string
+        */
+       private $propertyName;
+
+       /**
+        * The raw field value.
+        *
+        * @var mixed
+        */
+       private $fieldValue;
+       
+       /**
+        * Constructs this proxy instance.
+        *
+        * @param object $parentObject The object instance this proxy is part of
+        * @param string $propertyName The name of the proxied property in it's parent
+        * @param mixed $fieldValue The raw field value.
+        */
+       public function __construct($parentObject, $propertyName, $fieldValue) {
+               $this->parentObject = $parentObject;
+               $this->propertyName = $propertyName;
+               $this->fieldValue = $fieldValue;
+       }
+
+       /**
+        * Injects the DataMapper to map nodes to objects
+        *
+        * @param Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper
+        * @return void
+        */
+       public function injectDataMapper(Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper) {
+               $this->dataMapper = $dataMapper;
+       }
+
+       /**
+        * Populate this proxy by asking the $population closure.
+        *
+        * @return object The instance (hopefully) returned
+        */
+       public function _loadRealInstance() {
+               // this check safeguards against a proxy being activated multiple times
+               // usually that does not happen, but if the proxy is held from outside
+               // it's parent... the result would be weird.
+               if ($this->parentObject->_getProperty($this->propertyName) instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
+                       
+                       $objects = $this->dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE, FALSE);
+                       $propertyValue = $this->dataMapper->mapResultToPropertyValue($this->parentObject, $this->propertyName, $objects);
+                       $this->parentObject->_setProperty($this->propertyName, $propertyValue);
+                       $this->parentObject->_memorizeCleanState($this->propertyName);
+                       return $propertyValue;
+               } else {
+                       return $this->parentObject->_getProperty($this->propertyName);
+               }
+       }
+
+       /**
+        * Magic method call implementation.
+        *
+        * @param string $methodName The name of the property to get
+        * @param array $arguments The arguments given to the call
+        * @return mixed
+        */
+       public function __call($methodName, $arguments) {
+               $realInstance = $this->_loadRealInstance();
+               if (!is_object($realInstance)) {
+                       return NULL;
+               }
+               return call_user_func_array(array($realInstance, $methodName), $arguments);
+       }
+
+       /**
+        * Magic get call implementation.
+        *
+        * @param string $propertyName The name of the property to get
+        * @return mixed
+        */
+       public function __get($propertyName) {
+               $realInstance = $this->_loadRealInstance();
+               return $realInstance->$propertyName;
+       }
+
+       /**
+        * Magic set call implementation.
+        *
+        * @param string $propertyName The name of the property to set
+        * @param mixed $value The value for the property to set
+        * @return void
+        */
+       public function __set($propertyName, $value) {
+               $realInstance = $this->_loadRealInstance();
+               $realInstance->$propertyName = $value;
+       }
+
+       /**
+        * Magic isset call implementation.
+        *
+        * @param string $propertyName The name of the property to check
+        * @return boolean
+        */
+       public function __isset($propertyName) {
+               $realInstance = $this->_loadRealInstance();
+               return isset($realInstance->$propertyName);
+       }
+
+       /**
+        * Magic unset call implementation.
+        *
+        * @param string $propertyName The name of the property to unset
+        * @return void
+        */
+       public function __unset($propertyName) {
+               $realInstance = $this->_loadRealInstance();
+               unset($realInstance->$propertyName);
+       }
+       
+       /**
+        * Magic toString call implementation.
+        *
+        * @return void
+        */
+       public function __toString() {
+               $realInstance = $this->_loadRealInstance();
+               return $realInstance->__toString();
+       }
+       
+       /**
+        * Returns the current value of the storage array
+        *
+        * @return void
+        */
+       public function current() {
+               $realInstance = $this->_loadRealInstance();
+               return current($realInstance);
+       }
+
+       /**
+        * Returns the current key storage array
+        *
+        * @return void
+        */
+       public function key() {
+               $realInstance = $this->_loadRealInstance();
+               return key($realInstance);
+       }
+
+       /**
+        * Returns the next position of the storage array
+        *
+        * @return void
+        */
+       public function next() {
+               $realInstance = $this->_loadRealInstance();
+               next($realInstance);
+       }
+       
+       /**
+        * Resets the array pointer of the storage
+        *
+        * @return void
+        */
+       public function rewind() {
+               $realInstance = $this->_loadRealInstance();
+               reset($realInstance);
+       }
+
+       /**
+        * Checks if the array pointer of the storage points to a valid position
+        *
+        * @return void
+        */
+       public function valid() {
+               return $this->current() !== FALSE;
+       }
+
+       
+       
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php
new file mode 100644 (file)
index 0000000..ccc4e4c
--- /dev/null
@@ -0,0 +1,274 @@
+<?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 proxy that can replace any object and replaces itself in it's parent on
+ * first access (call, get, set, isset, unset).
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id$
+ */
+class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_ObjectStorage implements Tx_Extbase_Persistence_LoadingStrategyInterface {
+
+       /**
+        * This field is only needed to make debugging easier:
+        * If you call current() on a class that implements Iterator, PHP will return the first field of the object
+        * instead of calling the current() method of the interface.
+        * We use this unusual behavior of PHP to return the warning below in this case.
+        *
+        * @var string
+        */
+       private $warning = 'You should never see this warning. If you do, you probably used PHP array functions like current() on the Tx_Extbase_Persistence_LazyObjectStorage. To retrieve the first result, you can use the rewind() and current() methods.';
+
+       /**
+        * @var Tx_Extbase_Persistence_Mapper_DataMapper
+        */
+       protected $dataMapper;
+
+       /**
+        * The object this property is contained in.
+        *
+        * @var object
+        */
+       protected $parentObject;
+
+       /**
+        * The name of the property represented by this proxy.
+        *
+        * @var string
+        */
+       protected $propertyName;
+
+       /**
+        * The raw field value.
+        *
+        * @var mixed
+        */
+       protected $fieldValue;
+
+       /**
+        *
+        * @var bool
+        */
+       protected $isInitialized = FALSE;
+
+       /**
+        * Returns the state of the initialization
+        *
+        * @return void
+        */
+       public function isInitialized() {
+               return $this->isInitialized;
+       }
+
+       /**
+        * Constructs this proxy instance.
+        *
+        * @param object $parentObject The object instance this proxy is part of
+        * @param string $propertyName The name of the proxied property in it's parent
+        * @param mixed $fieldValue The raw field value.
+        */
+       public function __construct($parentObject, $propertyName, $fieldValue) {
+               $this->parentObject = $parentObject;
+               $this->propertyName = $propertyName;
+               $this->fieldValue = $fieldValue;
+               reset($this->storage);
+       }
+
+       /**
+        * Injects the DataMapper to map nodes to objects
+        *
+        * @param Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper
+        * @return void
+        */
+       public function injectDataMapper(Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper) {
+               $this->dataMapper = $dataMapper;
+       }
+
+       /**
+        * This is a function lazy load implementation.
+        *
+        * @return void
+        */
+       protected function initialize() {
+               if (!$this->isInitialized) {
+                       $this->isInitialized = TRUE;
+
+                       $objects = $this->dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE);
+                       foreach ($objects as $object) {
+                               parent::attach($object);
+                       }
+                       $this->_memorizeCleanState();
+                       $this->parentObject->_memorizeCleanState($this->propertyName);
+               }
+       }
+
+       // Delegation to the ObjectStorage methods below
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::addAll
+        */
+       public function addAll($storage) {
+               $this->initialize();
+               parent::addAll($storage);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::attach
+        */
+       public function attach($object, $data = NULL) {
+               $this->initialize();
+               parent::attach($object, $data);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::contains
+        */
+       public function contains($object) {
+               $this->initialize();
+               return parent::contains($object);
+       }
+
+       /**
+        * Counts the elements in the storage array
+        *
+        * @return int The number of elements in the ObjectStorage
+        */
+       public function count() {
+               $columnMap = $this->dataMapper->getDataMap(get_class($this->parentObject))->getColumnMap($this->propertyName);
+               $numberOfElements = NULL;
+               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
+                       $numberOfElements = $this->dataMapper->countRelated($this->parentObject, $this->propertyName, $this->fieldValue);
+               } else {
+                       $this->initialize();
+                       $numberOfElements = count($this->storage);
+               }
+               if (is_null($numberOfElements)) {
+                       throw new Tx_Extbase_Persistence_Exception('The number of elements could not be determined.', 1252514486);
+               }
+               return $numberOfElements;
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::current
+        */
+       public function current() {
+               $this->initialize();
+               return parent::current();
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::detach
+        */
+       public function detach($object) {
+               $this->initialize();
+               parent::detach($object);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::key
+        */
+       public function key() {
+               $this->initialize();
+               return parent::key();
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::next
+        */
+       public function next() {
+               $this->initialize();
+               parent::next();
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::offsetExists
+        */
+       public function offsetExists($object) {
+               $this->initialize();
+               return parent::offsetExists($object);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::offsetGet
+        */
+       public function offsetGet($object) {
+               $this->initialize();
+               return parent::offsetGet($object);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::offsetSet
+        */
+       public function offsetSet($object , $info) {
+               $this->initialize();
+               parent::offsetSet($object, $info);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::offsetUnset
+        */
+       public function offsetUnset($object) {
+               $this->initialize();
+               parent::offsetUnset($object);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::removeAll
+        */
+       public function removeAll($storage) {
+               $this->initialize();
+               parent::removeAll($storage);
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::rewind
+        */
+       public function rewind() {
+               $this->initialize();
+               parent::rewind();
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::valid
+        */
+       public function valid() {
+               $this->initialize();
+               return parent::valid();
+       }
+
+       /**
+        * @see Tx_Extbase_Persistence_ObjectStorage::toArray
+        */
+       public function toArray() {
+               $this->initialize();
+               return parent::toArray();
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/LoadingStrategyInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/LoadingStrategyInterface.php
new file mode 100644 (file)
index 0000000..9e9e30f
--- /dev/null
@@ -0,0 +1,38 @@
+<?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!
+ ***************************************************************/
+
+/**
+ * An interface for the lazy loading strategies.
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id$
+ */
+interface Tx_Extbase_Persistence_LoadingStrategyInterface {
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Manager.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Manager.php
new file mode 100644 (file)
index 0000000..f436147
--- /dev/null
@@ -0,0 +1,211 @@
+<?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!
+***************************************************************/
+
+/**
+ * The Extbase Persistence Manager
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id$
+ * @api
+ */
+class Tx_Extbase_Persistence_Manager implements Tx_Extbase_Persistence_ManagerInterface, t3lib_Singleton {
+
+       /**
+        * @var Tx_Extbase_Persistence_BackendInterface
+        */
+       protected $backend;
+
+       /**
+        * @var Tx_Extbase_Persistence_Session
+        */
+       protected $session;
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * This is an array of registered repository class names.
+        *
+        * @var array
+        */
+       protected $repositoryClassNames = array();
+
+       /**
+        * Injects the Persistence Backend
+        *
+        * @param Tx_Extbase_Persistence_BackendInterface $backend The persistence backend
+        * @return void
+        */
+       public function injectBackend(Tx_Extbase_Persistence_BackendInterface $backend) {
+               $this->backend = $backend;
+       }
+
+       /**
+        *
+        * Injects the Persistence Session
+        *
+        * @param Tx_Extbase_Persistence_Session $session The persistence session
+        * @return void
+        */
+       public function injectSession(Tx_Extbase_Persistence_Session $session) {
+               $this->session = $session;
+       }
+
+       /**
+        * Injects the object manager
+        *
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * Returns the current persistence session
+        *
+        * @return Tx_Extbase_Persistence_Session
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
+        */
+       public function getSession() {
+               return $this->session;
+       }
+
+       /**
+        * Returns the persistence backend
+        *
+        * @return Tx_Extbase_Persistence_BackendInterface
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
+        */
+       public function getBackend() {
+               return $this->backend;
+       }
+
+       /**
+        * Registers a repository
+        *
+        * @param string $className The class name of the repository to be reigistered
+        * @return void
+        */
+       public function registerRepositoryClassName($className) {
+               $this->repositoryClassNames[] = $className;
+       }
+
+       /**
+        * Returns the number of records matching the query.
+        *
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @return integer
+        * @api
+        */
+       public function getObjectCountByQuery(Tx_Extbase_Persistence_QueryInterface $query) {
+               return $this->backend->getObjectCountByQuery($query);
+       }
+
+       /**
+        * Returns the object data matching the $query.
+        *
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @return array
+        * @api
+        */
+       public function getObjectDataByQuery(Tx_Extbase_Persistence_QueryInterface $query) {
+               return $this->backend->getObjectDataByQuery($query);
+       }
+
+       /**
+        * Returns the (internal) identifier for the object, if it is known to the
+        * backend. Otherwise NULL is returned.
+        *
+        * Note: this returns an identifier even if the object has not been
+        * persisted in case of AOP-managed entities. Use isNewObject() if you need
+        * to distinguish those cases.
+        *
+        * @param object $object
+        * @return mixed The identifier for the object if it is known, or NULL
+        * @api
+        */
+       public function getIdentifierByObject($object) {
+               return $this->backend->getIdentifierByObject($object);
+       }
+
+       /**
+        * Returns the object with the (internal) identifier, if it is known to the
+        * backend. Otherwise NULL is returned.
+        *
+        * @param mixed $identifier
+        * @param string $objectType
+        * @return object The object for the identifier if it is known, or NULL
+        * @api
+        */
+       public function getObjectByIdentifier($identifier, $objectType) {
+               return $this->backend->getObjectByIdentifier($identifier, $objectType);
+       }
+
+       /**
+        * Commits new objects and changes to objects in the current persistence
+        * session into the backend
+        *
+        * @return void
+        * @api
+        */
+       public function persistAll() {
+               $aggregateRootObjects = new Tx_Extbase_Persistence_ObjectStorage();
+               $removedObjects = new Tx_Extbase_Persistence_ObjectStorage();
+
+                       // fetch and inspect objects from all known repositories
+               foreach ($this->repositoryClassNames as $repositoryClassName) {
+                       $repository = $this->objectManager->get($repositoryClassName);
+                       $aggregateRootObjects->addAll($repository->getAddedObjects());
+                       $removedObjects->addAll($repository->getRemovedObjects());
+               }
+
+               foreach ($this->session->getReconstitutedObjects() as $reconstitutedObject) {
+                       if (class_exists(str_replace('_Model_', '_Repository_', get_class($reconstitutedObject)) . 'Repository')) {
+                               $aggregateRootObjects->attach($reconstitutedObject);
+                       }
+               }
+
+                       // hand in only aggregate roots, leaving handling of subobjects to
+                       // the underlying storage layer
+               $this->backend->setAggregateRootObjects($aggregateRootObjects);
+               $this->backend->setDeletedObjects($removedObjects);
+               $this->backend->commit();
+
+                       // this needs to unregister more than just those, as at least some of
+                       // the subobjects are supposed to go away as well...
+                       // OTOH those do no harm, changes to the unused ones should not happen,
+                       // so all they do is eat some memory.
+               foreach($removedObjects as $removedObject) {
+                       $this->session->unregisterReconstitutedObject($removedObject);
+               }
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/ManagerInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/ManagerInterface.php
new file mode 100644 (file)
index 0000000..074858c
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+/*                                                                        *
+ * This script belongs to the Extbase framework.                          *
+ *                                                                        *
+ * This class is a backport of the corresponding class of FLOW3.          *
+ * All credits go to the v5 team.                                         *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License, either version 3   *
+ * of the License, or (at your option) any later version.                 *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * The Extbase Persistence Manager interface
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @deprecated since Extbase 6.0, will be removed in Extbase 7.0
+ */
+interface Tx_Extbase_Persistence_ManagerInterface extends Tx_Extbase_Persistence_PersistenceManagerInterface {
+
+       /**
+        * Returns the current persistence session
+        *
+        * @return Tx_Extbase_Persistence_Session
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 7.0
+        */
+       public function getSession();
+
+       /**
+        * Returns the persistence backend
+        *
+        * @return Tx_Extbase_Persistence_BackendInterface
+        * @deprecated since Extbase 1.4.0, will be removed in Extbase 7.0
+        */
+       public function getBackend();
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/ColumnMap.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/ColumnMap.php
new file mode 100644 (file)
index 0000000..b5a7455
--- /dev/null
@@ -0,0 +1,290 @@
+<?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 column map to map a column configured in $TCA on a property of a domain object.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Mapper
+ * @version $ID:$
+ */
+// SK: PHPDoc ;-)
+class Tx_Extbase_Persistence_Mapper_ColumnMap {
+
+       /**
+        * Constants reflecting the type of relation
+        */
+       const RELATION_NONE = 'RELATION_NONE';
+       const RELATION_HAS_ONE = 'RELATION_HAS_ONE';
+       const RELATION_HAS_MANY = 'RELATION_HAS_MANY';
+       const RELATION_BELONGS_TO_MANY = 'RELATION_BELONGS_TO_MANY';
+       const RELATION_HAS_AND_BELONGS_TO_MANY = 'RELATION_HAS_AND_BELONGS_TO_MANY';
+
+       /**
+        * Constants reflecting how the relation information is stored
+        */
+       const RELATION_PARENT_FOREIGN_KEY = 'RELATION_PARENT_FOREIGN_KEY';
+       const RELATION_CHILD_FOREIGN_KEY = 'RELATION_CHILD_FOREIGN_KEY';
+       const RELATION_PARENT_CSV = 'RELATION_PARENT_CSV';
+       const RELATION_INTERMEDIATE_TABLE = 'RELATION_INTERMEDIATE_TABLE';
+
+       /**
+        * Constants reflecting the loading strategy
+        */
+       const STRATEGY_EAGER = 'eager';
+       const STRATEGY_LAZY_PROXY = 'proxy';
+       const STRATEGY_LAZY_STORAGE = 'storage';
+       
+       /**
+        * The property name corresponding to the table name
+        *
+        * @var string
+        **/
+       protected $propertyName;
+
+       /**
+        * The column name
+        *
+        * @var string
+        **/
+       protected $columnName;
+
+       /**
+        * The type of relation
+        *
+        * @var int
+        **/
+       protected $typeOfRelation;
+
+       /**
+        * The name of the child's class
+        *
+        * @var string
+        **/
+       protected $childClassName;
+
+       /**
+        * The name of the child's table
+        *
+        * @var string
+        **/
+       protected $childTableName;
+
+       /**
+        * The where clause to narrow down the selected child records
+        *
+        * @var string
+        **/
+       protected $childTableWhereStatement;
+
+       /**
+        * The name of the field the results from the child's table are sorted by
+        *
+        * @var string
+        **/
+       protected $childSortByFieldName;
+
+       /**
+        * The name of the relation table
+        *
+        * @var string
+        **/
+       protected $relationTableName;
+
+       /**
+        * The name of the column  of the relation table holding the page id
+        *
+        * @var string
+        **/
+       protected $relationTablePageIdColumnName;
+
+       /**
+        * An array of field => value pairs to both insert and match against when writing/reading MM relations
+        *
+        * @var array
+        **/
+       protected $relationTableMatchFields;
+
+       /**
+        * Array of field=>value pairs to insert when writing new MM relations
+        *
+        * @var array
+        **/
+       protected $relationTableInsertFields;
+
+       /**
+        * The where clause to narrow down the selected relation table records
+        *
+        * @var string
+        **/
+       protected $relationTableWhereStatement;
+
+       /**
+        * The name of the field holding the parents key
+        *
+        * @var string
+        **/
+       protected $parentKeyFieldName;
+
+       /**
+        * The name of the field holding the name of the table of the parent's records
+        *
+        * @var string
+        **/
+       protected $parentTableFieldName;
+
+       /**
+        * The name of the field holding the children key
+        *
+        * @var string
+        **/
+       protected $childKeyFieldName;
+
+       /**
+        * Constructs a Column Map
+        *
+        * @param string $columnName The column name
+        * @param string $propertyName The property name
+        * @return void
+        */
+       public function __construct($columnName, $propertyName) {
+               // TODO Enable aliases (tx_anotherextension_addedcolumn -> theAddedColumn)
+               $this->setColumnName($columnName);
+               $this->setPropertyName($propertyName);
+       }
+
+       public function setTypeOfRelation($typeOfRelation) {
+               $this->typeOfRelation = $typeOfRelation;
+       }
+
+       public function getTypeOfRelation() {
+               return $this->typeOfRelation;
+       }
+
+       public function setPropertyName($propertyName) {
+               $this->propertyName = $propertyName;
+       }
+
+       public function getPropertyName() {
+               return $this->propertyName;
+       }
+
+       public function setColumnName($columnName) {
+               $this->columnName = $columnName;
+       }
+
+       public function getColumnName() {
+               return $this->columnName;
+       }
+       
+       public function setChildTableName($childTableName) {
+               $this->childTableName = $childTableName;
+       }
+
+       public function getChildTableName() {
+               return $this->childTableName;
+       }
+
+       public function setChildTableWhereStatement($childTableWhereStatement) {
+               $this->childTableWhereStatement = $childTableWhereStatement;
+       }
+
+       public function getChildTableWhereStatement() {
+               return $this->childTableWhereStatement;
+       }
+
+       public function setChildSortByFieldName($childSortByFieldName) {
+               $this->childSortByFieldName = $childSortByFieldName;
+       }
+
+       public function getChildSortByFieldName() {
+               return $this->childSortByFieldName;
+       }
+
+       public function setRelationTableName($relationTableName) {
+               $this->relationTableName = $relationTableName;
+       }
+
+       public function getRelationTableName() {
+               return $this->relationTableName;
+       }
+
+       public function setRelationTablePageIdColumnName($relationTablePageIdColumnName) {
+               $this->relationTablePageIdColumnName = $relationTablePageIdColumnName;
+       }
+
+       public function getRelationTablePageIdColumnName() {
+               return $this->relationTablePageIdColumnName;
+       }
+
+       public function setRelationTableMatchFields(array $relationTableMatchFields) {
+               $this->relationTableMatchFields = $relationTableMatchFields;
+       }
+
+       public function getRelationTableMatchFields() {
+               return $this->relationTableMatchFields;
+       }
+
+       public function setRelationTableInsertFields(array $relationTableInsertFields) {
+               $this->relationTableInsertFields = $relationTableInsertFields;
+       }
+
+       public function getRelationTableInsertFields() {
+               return $this->relationTableInsertFields;
+       }
+
+       public function setRelationTableWhereStatement($relationTableWhereStatement) {
+               $this->relationTableWhereStatement = $relationTableWhereStatement;
+       }
+
+       public function getRelationTableWhereStatement() {
+               return $this->relationTableWhereStatement;
+       }
+
+       public function setParentKeyFieldName($parentKeyFieldName) {
+               $this->parentKeyFieldName = $parentKeyFieldName;
+       }
+
+       public function getParentKeyFieldName() {
+               return $this->parentKeyFieldName;
+       }
+
+       public function setParentTableFieldName($parentTableFieldName) {
+               $this->parentTableFieldName = $parentTableFieldName;
+       }
+
+       public function getParentTableFieldName() {
+               return $this->parentTableFieldName;
+       }
+
+       public function setChildKeyFieldName($childKeyFieldName) {
+               $this->childKeyFieldName = $childKeyFieldName;
+       }
+
+       public function getChildKeyFieldName() {
+               return $this->childKeyFieldName;
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php
new file mode 100644 (file)
index 0000000..4bce3b4
--- /dev/null
@@ -0,0 +1,477 @@
+<?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 data map to map a single table configured in $TCA on a domain object.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Mapper
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Mapper_DataMap {
+       
+       /**
+        * The class name
+        *
+        * @var string
+        **/
+       protected $className;
+
+       /**
+        * The table name corresponding to the domain class configured in $TCA
+        *
+        * @var string
+        **/
+       protected $tableName;
+
+       /**
+        * The record type stored in the "type" field as configured in $TCA
+        *
+        * @var string
+        **/
+       protected $recordType;
+
+       /**
+        * The subclasses of the current class
+        *
+        * @var array
+        **/
+       protected $subclasses = array();
+
+       /**
+        * An array of column maps configured in $TCA
+        *
+        * @var array
+        **/
+       protected $columnMaps = array();
+               
+       /**
+        * @var string
+        **/
+       protected $pageIdColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $languageIdColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $translationOriginColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $modificationDateColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $creationDateColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $creatorColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $deletedFlagColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $disabledFlagColumnName;
+       
+       /**
+        * @var string
+        **/
+       protected $startTimeColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $endTimeColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $frontendUserGroupColumnName;
+
+       /**
+        * @var string
+        **/
+       protected $recordTypeColumnName;
+
+       /**
+        * Constructs this DataMap
+        *
+        * @param string $className The class name
+        * @param string $tableName The table name
+        * @param string $recordType The record type
+        * @param array $subclasses The subclasses
+        */
+       public function __construct($className, $tableName, $recordType = NULL, array $subclasses = array()) {
+               $this->setClassName($className);
+               $this->setTableName($tableName);
+               $this->setRecordType($recordType);
+               $this->setSubclasses($subclasses);
+       }
+
+       /**
+        * Sets the name of the class the colum map represents
+        *
+        * @return void
+        */
+       public function setClassName($className) {
+               $this->className = $className;
+       }
+
+       /**
+        * Returns the name of the class the column map represents
+        *
+        * @return string The class name
+        */
+       public function getClassName() {
+               return $this->className;
+       }
+
+       /**
+        * Sets the name of the table the colum map represents
+        *
+        * @return void
+        */
+       public function setTableName($tableName) {
+               $this->tableName = $tableName;
+       }
+
+       /**
+        * Returns the name of the table the column map represents
+        *
+        * @return string The table name
+        */
+       public function getTableName() {
+               return $this->tableName;
+       }
+       
+       /**
+        * Sets the record type
+        *
+        * @param string $recordType The record type
+        * @return void
+        */
+       public function setRecordType($recordType) {
+               $this->recordType = $recordType;
+       }
+
+       /**
+        * Returns the record type
+        *
+        * @return string The record type
+        */
+       public function getRecordType() {
+               return $this->recordType;
+       }
+       
+       /**
+        * Sets the subclasses
+        *
+        * @param array $subclasses An array of subclasses
+        * @return void
+        */
+       public function setSubclasses(array $subclasses) {
+               $this->subclasses = $subclasses;
+       }
+
+       /**
+        * Returns the subclasses
+        *
+        * @return array The subclasses
+        */
+       public function getSubclasses() {
+               return $this->subclasses;
+       }
+       
+       /**
+        * Adds a given column map to the data map.
+        *
+        * @param Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap The column map
+        * @return void
+        */
+       public function addColumnMap(Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap) {
+               $this->columnMaps[$columnMap->getPropertyName()] = $columnMap;
+       }
+       
+       /**
+        * Returns the column map corresponding to the given property name.
+        *
+        * @param string $propertyName
+        * @return Tx_Extbase_Persistence_Mapper_ColumnMap|NULL The column map or NULL if no corresponding column map was found.
+        */
+       public function getColumnMap($propertyName) {
+               return $this->columnMaps[$propertyName];
+       }
+
+       /**
+        * Returns TRUE if the property is persistable (configured in $TCA)
+        *
+        * @param string $propertyName The property name
+        * @return boolean TRUE if the property is persistable (configured in $TCA)
+        */
+       public function isPersistableProperty($propertyName) {
+               return isset($this->columnMaps[$propertyName]);
+       }
+       
+       
+       /**
+        * Sets the name of a column holding the page id
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setPageIdColumnName($pageIdColumnName) {
+               $this->pageIdColumnName = $pageIdColumnName;
+       }
+       
+       /**
+        * Sets the name of a column holding the page id
+        *
+        * @return string The field name
+        */
+       public function getPageIdColumnName() {
+               return $this->pageIdColumnName;
+       }
+       
+       /**
+        * Sets the name of a column holding the language id of the record
+        *
+        * @param string $languageIdColumnName The field name
+        * @return void
+        */
+       public function setLanguageIdColumnName($languageIdColumnName) {
+               $this->languageIdColumnName = $languageIdColumnName;
+       }
+               
+       /**
+        * Returns the name of a column holding the language id of the record.
+        *
+        * @return string The field name
+        */
+       public function getLanguageIdColumnName() {
+               return $this->languageIdColumnName;
+       }
+       
+       /**
+        * Sets the name of a column holding the the uid of the record which this record is a translation of.
+        *
+        * @param string $translationOriginColumnName The field name
+        * @return void
+        */
+       public function setTranslationOriginColumnName($translationOriginColumnName) {
+               $this->translationOriginColumnName = $translationOriginColumnName;
+       }
+               
+       /**
+        * Returns the name of a column holding the the uid of the record which this record is a translation of.
+        *
+        * @return string The field name
+        */
+       public function getTranslationOriginColumnName() {
+               return $this->translationOriginColumnName;
+       }
+       
+       /**
+        * Sets the name of a column holding the timestamp the record was modified
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setModificationDateColumnName($modificationDateColumnName) {
+               $this->modificationDateColumnName = $modificationDateColumnName;
+       }
+       
+       /**
+        * Returns the name of a column holding the timestamp the record was modified
+        *
+        * @return string The field name
+        */
+       public function getModificationDateColumnName() {
+               return $this->modificationDateColumnName;
+       }
+       
+       /**
+        * Sets the name of a column holding the creation date timestamp
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setCreationDateColumnName($creationDateColumnName) {
+               $this->creationDateColumnName = $creationDateColumnName;
+       }
+       
+       /**
+        * Returns the name of a column holding the creation date timestamp
+        *
+        * @return string The field name
+        */
+       public function getCreationDateColumnName() {
+               return $this->creationDateColumnName;
+       }
+       
+       /**
+        * Sets the name of a column holding the uid of the back-end user who created this record
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setCreatorColumnName($creatorColumnName) {
+               $this->creatorColumnName = $creatorColumnName;
+       }
+
+       /**
+        * Returns the name of a column holding the uid of the back-end user who created this record
+        *
+        * @return string The field name
+        */
+       public function getCreatorColumnName() {
+               return $this->creatorColumnName;
+       }
+
+       /**
+        * Sets the name of a column indicating the 'deleted' state of the row
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setDeletedFlagColumnName($deletedFlagColumnName) {
+               $this->deletedFlagColumnName = $deletedFlagColumnName;
+       }
+       
+       /**
+        * Returns the name of a column indicating the 'deleted' state of the row
+        *
+        * @return string The field name
+        */
+       public function getDeletedFlagColumnName() {
+               return $this->deletedFlagColumnName;
+       }
+       
+       /**
+        * Sets the name of a column indicating the 'hidden' state of the row
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setDisabledFlagColumnName($disabledFlagColumnName) {
+               $this->disabledFlagColumnName = $disabledFlagColumnName;
+       }
+       
+       /**
+        * Returns the name of a column indicating the 'hidden' state of the row
+        *
+        * @return string The field name
+        */
+       public function getDisabledFlagColumnName() {
+               return $this->disabledFlagColumnName;
+       }
+       
+       /**
+        * Sets the name of a column holding the timestamp the record should not displayed before
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setStartTimeColumnName($startTimeColumnName) {
+               $this->startTimeColumnName = $startTimeColumnName;
+       }
+
+       /**
+        * Returns the name of a column holding the timestamp the record should not displayed before
+        *
+        * @return string The field name
+        */
+       public function getStartTimeColumnName() {
+               return $this->startTimeColumnName;
+       }
+
+       /**
+        * Sets the name of a column holding the timestamp the record should not displayed afterwards
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setEndTimeColumnName($endTimeColumnName) {
+               $this->endTimeColumnName = $endTimeColumnName;
+       }
+
+       /**
+        * Returns the name of a column holding the timestamp the record should not displayed afterwards
+        *
+        * @return string The field name
+        */
+       public function getEndTimeColumnName() {
+               return $this->endTimeColumnName;
+       }
+
+       /**
+        * Sets the name of a column holding the uid of the front-end user group which is allowed to edit this record
+        *
+        * @param string The field name
+        * @return void
+        */
+       public function setFrontEndUserGroupColumnName($frontendUserGroupColumnName) {
+               $this->frontendUserGroupColumnName = $frontendUserGroupColumnName;
+       }
+
+       /**
+        * Returns the name of a column holding the uid of the front-end user group which is allowed to edit this record
+        *
+        * @return string The field name
+        */
+       public function getFrontEndUserGroupColumnName() {
+               return $this->frontendUserGroupColumnName;
+       }
+
+       /**
+        * Sets the name of a column holding the record type
+        *
+        * @param string $recordTypeColumnName The field name
+        * @return void
+        */
+       public function setRecordTypeColumnName($recordTypeColumnName) {
+               $this->recordTypeColumnName = $recordTypeColumnName;
+       }
+
+       /**
+        * Sets the name of a column holding the record type
+        *
+        * @return string The field name
+        */
+       public function getRecordTypeColumnName() {
+               return $this->recordTypeColumnName;
+       }
+
+}
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
new file mode 100644 (file)
index 0000000..9d86d60
--- /dev/null
@@ -0,0 +1,329 @@
+<?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 factory for a data map to map a single table configured in $TCA on a domain object.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Mapper
+ * @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;
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+
+
+       /**
+        * Injects the reflection service
+        *
+        * @param Tx_Extbase_Reflection_Service $reflectionService
+        * @return void
+        */
+       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;
+       }
+
+       /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * 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
+        * represents.
+        *
+        * @param string $className The class name you want to fetch the Data Map for
+        * @return Tx_Extbase_Persistence_Mapper_DataMap The data map
+        */
+       public function buildDataMap($className) {
+               if (!class_exists($className)) {
+                       throw new Tx_Extbase_Persistence_Exception_InvalidClass('Could not find class definition for name "' . $className . '". This could be caused by a mis-spelling of the class name in the class definition.');
+               }
+
+               $recordType = NULL;
+               $subclasses = array();
+               $tableName = strtolower($className);
+               $columnMapping = array();
+
+               $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 = $this->resolveSubclassesRecursive(
+                                       $frameworkConfiguration['persistence']['classes'], $classSettings['subclasses']
+                               );
+                       }
+                       if (isset($classSettings['mapping']['recordType']) && strlen($classSettings['mapping']['recordType']) > 0) {
+                               $recordType = $classSettings['mapping']['recordType'];
+                       }
+                       if (isset($classSettings['mapping']['tableName']) && strlen($classSettings['mapping']['tableName']) > 0) {
+                               $tableName = $classSettings['mapping']['tableName'];
+                       }
+                       $classHierachy = array_merge(array($className), class_parents($className));
+                       foreach ($classHierachy as $currentClassName) {
+                               if (in_array($currentClassName, array('Tx_Extbase_DomainObject_AbstractEntity', 'Tx_Extbase_DomainObject_AbstractValueObject'))) {
+                                       break;
+                               }
+                               $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
+                                       }
+                               }
+                       }
+               }
+
+               $dataMap = $this->objectManager->create('Tx_Extbase_Persistence_Mapper_DataMap', $className, $tableName, $recordType, $subclasses);
+               $dataMap = $this->addMetaDataColumnNames($dataMap, $tableName);
+
+               // $classPropertyNames = $this->reflectionService->getClassPropertyNames($className);
+               $tcaColumnsDefinition = $this->getColumnsDefinition($tableName);
+               $tcaColumnsDefinition = t3lib_div::array_merge_recursive_overrule($tcaColumnsDefinition, $columnMapping); // TODO Is this is too powerful?
+               foreach ($tcaColumnsDefinition as $columnName => $columnDefinition) {
+                       if (isset($columnDefinition['mapOnProperty'])) {
+                               $propertyName = $columnDefinition['mapOnProperty'];
+                       } else {
+                               $propertyName = t3lib_div::underscoredToLowerCamelCase($columnName);
+                       }
+                       // if (in_array($propertyName, $classPropertyNames)) { // TODO Enable check for property existance
+                               $columnMap = new Tx_Extbase_Persistence_Mapper_ColumnMap($columnName, $propertyName);
+                               $propertyMetaData = $this->reflectionService->getClassSchema($className)->getProperty($propertyName);
+                               $columnMap = $this->setRelations($columnMap, $columnDefinition['config'], $propertyMetaData);
+                               $dataMap->addColumnMap($columnMap);
+                       // }
+               }
+               // debug($dataMap);
+               return $dataMap;
+       }
+
+       /**
+        * Resolves all subclasses for the given set of (sub-)classes.
+        * The whole classes configuration is used to determine all subclasses recursively.
+        *
+        * @param array $classes The framework configuration part [persistence][classes].
+        * @param array $subclasses An array of subclasses defined via TypoScript
+        * @return array An numeric array that contains all available subclasses-strings as values.
+        */
+       protected function resolveSubclassesRecursive(array $classesConfiguration, array $subclasses) {
+               $allSubclasses = array();
+
+               foreach ($subclasses as $subclass) {
+                       $allSubclasses[] = $subclass;
+                       if (isset($classesConfiguration[$subclass]['subclasses']) && is_array($classesConfiguration[$subclass]['subclasses'])) {
+                               $childSubclasses = $this->resolveSubclassesRecursive($classesConfiguration, $classesConfiguration[$subclass]['subclasses']);
+                               $allSubclasses = array_merge($allSubclasses,$childSubclasses);
+                       }
+               }
+
+               return $allSubclasses;
+       }
+
+       /**
+        * Returns the TCA ctrl section of the specified table; or NULL if not set
+        *
+        * @param string $tableName An optional table name to fetch the columns definition from
+        * @return array The TCA columns definition
+        */
+       protected function getControlSection($tableName) {
+               $this->includeTca($tableName);
+               return is_array($GLOBALS['TCA'][$tableName]['ctrl']) ? $GLOBALS['TCA'][$tableName]['ctrl'] : NULL;
+       }
+
+       /**
+        * Returns the TCA columns array of the specified table
+        *
+        * @param string $tableName An optional table name to fetch the columns definition from
+        * @return array The TCA columns definition
+        */
+       protected function getColumnsDefinition($tableName) {
+               $this->includeTca($tableName);
+               return is_array($GLOBALS['TCA'][$tableName]['columns']) ? $GLOBALS['TCA'][$tableName]['columns'] : array();
+       }
+
+       /**
+        * Includes the TCA for the given table
+        *
+        * @param string $tableName An optional table name to fetch the columns definition from
+        * @return void
+        */
+       protected function includeTca($tableName) {
+               if (TYPO3_MODE === 'FE') {
+                       $GLOBALS['TSFE']->includeTCA();
+               }
+               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['tstamp'])) $dataMap->setModificationDateColumnName($controlSection['tstamp']);
+               if (isset($controlSection['crdate'])) $dataMap->setCreationDateColumnName($controlSection['crdate']);
+               if (isset($controlSection['cruser_id'])) $dataMap->setCreatorColumnName($controlSection['cruser_id']);
+               if (isset($controlSection['delete'])) $dataMap->setDeletedFlagColumnName($controlSection['delete']);
+               if (isset($controlSection['languageField'])) $dataMap->setLanguageIdColumnName($controlSection['languageField']);
+               if (isset($controlSection['transOrigPointerField'])) $dataMap->setTranslationOriginColumnName($controlSection['transOrigPointerField']);
+               if (isset($controlSection['type'])) $dataMap->setRecordTypeColumnName($controlSection['type']);
+               if (isset($controlSection['enablecolumns']['disabled'])) $dataMap->setDisabledFlagColumnName($controlSection['enablecolumns']['disabled']);
+               if (isset($controlSection['enablecolumns']['starttime'])) $dataMap->setStartTimeColumnName($controlSection['enablecolumns']['starttime']);
+               if (isset($controlSection['enablecolumns']['endtime'])) $dataMap->setEndTimeColumnName($controlSection['enablecolumns']['endtime']);
+               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
+        *
+        * @param Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap The column map
+        * @param string $columnConfiguration The column configuration from $TCA
+        * @param array $propertyMetaData The property metadata as delivered by the reflection service
+        * @return void
+        */
+       protected function setRelations(Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap, $columnConfiguration, $propertyMetaData) {
+               if (isset($columnConfiguration)) {
+                       if (isset($columnConfiguration['MM']) || isset($columnConfiguration['foreign_selector'])) {
+                               $columnMap = $this->setManyToManyRelation($columnMap, $columnConfiguration);
+                       } elseif (isset($propertyMetaData['elementType'])) {
+                               $columnMap = $this->setOneToManyRelation($columnMap, $columnConfiguration);
+                       } elseif (isset($propertyMetaData['type']) && strpos($propertyMetaData['type'], '_') !== FALSE) {
+                               $columnMap = $this->setOneToOneRelation($columnMap, $columnConfiguration);
+                       } else {
+                                       $columnMap->setTypeOfRelation(Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_NONE);
+                       }
+               } else {
+                       $columnMap->setTypeOfRelation(Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_NONE);
+               }
+               return $columnMap;
+       }
+
+       /**
+        * This method sets the configuration for a 1:1 relation based on
+        * the $TCA column configuration
+        *
+        * @param string $columnMap The column map
+        * @param string $columnConfiguration The column configuration from $TCA
+        * @return void
+        */
+       protected function setOneToOneRelation(Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap, $columnConfiguration) {
+               $columnMap->setTypeOfRelation(Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE);
+               $columnMap->setChildTableName($columnConfiguration['foreign_table']);
+               $columnMap->setChildTableWhereStatement($columnConfiguration['foreign_table_where']);
+               $columnMap->setChildSortByFieldName($columnConfiguration['foreign_sortby']);
+               $columnMap->setParentKeyFieldName($columnConfiguration['foreign_field']);
+               $columnMap->setParentTableFieldName($columnConfiguration['foreign_table_field']);
+               return $columnMap;
+       }
+
+       /**
+        * This method sets the configuration for a 1:n relation based on
+        * the $TCA column configuration
+        *
+        * @param string $columnMap The column map
+        * @param string $columnConfiguration The column configuration from $TCA
+        * @return void
+        */
+       protected function setOneToManyRelation(Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap, $columnConfiguration) {
+               $columnMap->setTypeOfRelation(Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY);
+               $columnMap->setChildTableName($columnConfiguration['foreign_table']);
+               $columnMap->setChildTableWhereStatement($columnConfiguration['foreign_table_where']);
+               $columnMap->setChildSortByFieldName($columnConfiguration['foreign_sortby']);
+               $columnMap->setParentKeyFieldName($columnConfiguration['foreign_field']);
+               $columnMap->setParentTableFieldName($columnConfiguration['foreign_table_field']);
+               return $columnMap;
+       }
+
+       /**
+        * This method sets the configuration for a m:n relation based on
+        * the $TCA column configuration
+        *
+        * @param string $columnMap The column map
+        * @param string $columnConfiguration The column configuration from $TCA
+        * @return void
+        */
+       protected function setManyToManyRelation(Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap, $columnConfiguration) {
+               $columnMap->setTypeOfRelation(Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY);
+               if (isset($columnConfiguration['MM'])) {
+                       $columnMap->setChildTableName($columnConfiguration['foreign_table']);
+                       $columnMap->setChildTableWhereStatement($columnConfiguration['foreign_table_where']);
+                       $columnMap->setRelationTableName($columnConfiguration['MM']);
+                       if (is_array($columnConfiguration['MM_match_fields'])) {
+                               $columnMap->setRelationTableMatchFields($columnConfiguration['MM_match_fields']);
+                       }
+                       if (is_array($columnConfiguration['MM_insert_fields'])) {
+                               $columnMap->setRelationTableInsertFields($columnConfiguration['MM_insert_fields']);
+                       }
+                       $columnMap->setRelationTableWhereStatement($columnConfiguration['MM_table_where']);
+                       if (!empty($columnConfiguration['MM_opposite_field'])) {
+                               $columnMap->setParentKeyFieldName('uid_foreign');
+                               $columnMap->setChildKeyFieldName('uid_local');
+                               $columnMap->setChildSortByFieldName('sorting_foreign');
+                       } else {
+                               $columnMap->setParentKeyFieldName('uid_local');
+                               $columnMap->setChildKeyFieldName('uid_foreign');
+                               $columnMap->setChildSortByFieldName('sorting');
+                       }
+               } elseif (isset($columnConfiguration['foreign_selector'])) {
+                       $columns = $this->getColumnsDefinition($columnConfiguration['foreign_table']);
+                       $childKeyFieldName = $columnConfiguration['foreign_selector'];
+                       $columnMap->setChildTableName($columns[$childKeyFieldName]['config']['foreign_table']);
+                       $columnMap->setRelationTableName($columnConfiguration['foreign_table']);
+                       $columnMap->setParentKeyFieldName($columnConfiguration['foreign_field']);
+                       $columnMap->setChildKeyFieldName($childKeyFieldName);
+                       $columnMap->setChildSortByFieldName($columnConfiguration['foreign_sortby']);
+               } else {
+                       throw new Tx_Extbase_Persistence_Exception_UnsupportedRelation('The given information to build a many-to-many-relation was not sufficient. Check your TCA definitions. mm-relations with IRRE must have at least a defined "MM" or "foreign_selector".', 1268817963);
+               }
+               if ($this->getControlSection($columnMap->getRelationTableName()) !== NULL) {
+                       $columnMap->setRelationTablePageIdColumnName('pid');
+               }
+               return $columnMap;
+       }
+
+}
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
new file mode 100644 (file)
index 0000000..182ff06
--- /dev/null
@@ -0,0 +1,583 @@
+<?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 mapper to map database tables configured in $TCA on domain objects.
+ *
+ * @package Extbase
+ * @subpackage Persistence\Mapper
+ * @version $ID:$
+ */
+class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
+
+       /**
+        * @var Tx_Extbase_Persistence_IdentityMap
+        */
+       protected $identityMap;
+
+       /**
+        * @var Tx_Extbase_Reflection_Service
+        */
+       protected $reflectionService;
+
+       /**
+        * @var Tx_Extbase_Persistence_QOM_QueryObjectModelFactory
+        */
+       protected $qomFactory;
+
+       /**
+        * @var Tx_Extbase_Persistence_Session
+        */
+       protected $persistenceSession;
+
+       /**
+        * A reference to the page select object providing methods to perform language and work space overlays
+        *
+        * @var t3lib_pageSelect
+        **/
+       protected $pageSelectObject;
+
+       /**
+        * Cached data maps
+        *
+        * @var array
+        **/
+       protected $dataMaps = array();
+
+       /**
+        * @var Tx_Extbase_Persistence_Mapper_DataMapFactory
+        */
+       protected $dataMapFactory;
+
+       /**
+        * @var Tx_Extbase_Persistence_QueryFactoryInterface
+        */
+       protected $queryFactory;
+
+       /**
+        * The TYPO3 reference index object
+        *
+        * @var t3lib_refindex
+        **/
+       protected $referenceIndex;
+
+       /**
+        * @var Tx_Extbase_Object_ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * @var Tx_Extbase_Object_Container_Container
+        */
+       protected $objectContainer;
+
+       /**
+        * Injects the identity map
+        *
+        * @param Tx_Extbase_Persistence_IdentityMap $identityMap
+        * @return void
+        */
+       public function injectIdentityMap(Tx_Extbase_Persistence_IdentityMap $identityMap) {
+               $this->identityMap = $identityMap;
+       }
+
+       /**
+        * Injects the persistence session
+        *
+        * @param Tx_Extbase_Persistence_Session $persistenceSession
+        * @return void
+        */
+       public function injectSession(Tx_Extbase_Persistence_Session $persistenceSession) {
+               $this->persistenceSession = $persistenceSession;
+       }
+
+       /**
+        * Injects the Reflection Service
+        *
+        * @param Tx_Extbase_Reflection_Service
+        * @return void
+        */
+       public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
+               $this->reflectionService = $reflectionService;
+       }
+
+       /**
+        * Injects the DataMap Factory
+        *
+        * @param Tx_Extbase_Persistence_Mapper_DataMapFactory
+        * @return void
+        */
+       public function injectDataMapFactory(Tx_Extbase_Persistence_Mapper_DataMapFactory $dataMapFactory) {
+               $this->dataMapFactory = $dataMapFactory;
+       }
+
+       /**
+        * Injects the Query Factory
+        *
+        * @param Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory
+        */
+       public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory) {
+               $this->queryFactory = $queryFactory;
+       }
+
+       /**
+        * Sets the query object model factory
+        *
+        * @param Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory
+        * @return void
+        */
+       public function injectQomFactory(Tx_Extbase_Persistence_QOM_QueryObjectModelFactory $qomFactory) {
+               $this->qomFactory = $qomFactory;
+       }
+
+       /**
+        * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * @param Tx_Extbase_Object_Container_Container $objectContainer
+        * @return void
+        */
+       public function injectObjectContainer(Tx_Extbase_Object_Container_Container $objectContainer) {
+               $this->objectContainer = $objectContainer;
+       }
+
+       /**
+        * Maps the given rows on objects
+        *
+        * @param string $className The name of the class
+        * @param array $rows An array of arrays with field_name => value pairs
+        * @return array An array of objects of the given class
+        */
+       public function map($className, array $rows) {
+               $objects = array();
+               foreach ($rows as $row) {
+                       $objects[] = $this->mapSingleRow($this->getTargetType($className, $row), $row);
+               }
+               return $objects;
+       }
+
+       /**
+        * Returns the target type for the given row.
+        *
+        * @param string $className The name of the class
+        * @param array $row A single array with field_name => value pairs
+        * @return string The target type (a class name)
+        */
+       public function getTargetType($className, array $row) {
+               $dataMap = $this->getDataMap($className);
+               $targetType = $className;
+               if ($dataMap->getRecordTypeColumnName() !== NULL) {
+                       foreach ($dataMap->getSubclasses() as $subclassName) {
+                               $recordSubtype = $this->getDataMap($subclassName)->getRecordType();
+                               if ($row[$dataMap->getRecordTypeColumnName()] === $recordSubtype) {
+                                       $targetType =  $subclassName;
+                                       break;
+                               }
+                       }
+               }
+               return $targetType;
+       }
+
+       /**
+        * Maps a single row on an object of the given class
+        *
+        * @param string $className The name of the target class
+        * @param array $row A single array with field_name => value pairs
+        * @return object An object of the given class
+        */
+       protected function mapSingleRow($className, array $row) {
+               if ($this->identityMap->hasIdentifier($row['uid'], $className)) {
+                       $object = $this->identityMap->getObjectByIdentifier($row['uid'], $className);
+               } else {
+                       $object = $this->createEmptyObject($className);
+                       $this->identityMap->registerObject($object, $row['uid']);
+                       $this->thawProperties($object, $row);
+                       $object->_memorizeCleanState();
+                       $this->persistenceSession->registerReconstitutedObject($object);
+               }
+               return $object;
+       }
+
+       /**
+        * Creates a skeleton of the specified object
+        *
+        * @param string $className Name of the class to create a skeleton for
+        * @return object The object skeleton
+        */
+       protected function createEmptyObject($className) {
+               // Note: The class_implements() function also invokes autoload to assure that the interfaces
+               // and the class are loaded. Would end up with __PHP_Incomplete_Class without it.
+               if (!in_array('Tx_Extbase_DomainObject_DomainObjectInterface', class_implements($className))) throw new Tx_Extbase_Object_Exception_CannotReconstituteObject('Cannot create empty instance of the class "' . $className . '" because it does not implement the Tx_Extbase_DomainObject_DomainObjectInterface.', 1234386924);
+               $object = $this->objectContainer->getEmptyObject($className);
+               return $object;
+       }
+
+       /**
+        * Sets the given properties on the object.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object to set properties on
+        * @param array $row
+        * @return void
+        */
+       protected function thawProperties(Tx_Extbase_DomainObject_DomainObjectInterface $object, array $row) {
+               $className = get_class($object);
+               $dataMap = $this->getDataMap($className);
+               $object->_setProperty('uid', intval($row['uid']));
+               $object->_setProperty('pid', intval($row['pid']));
+               $object->_setProperty('_localizedUid', intval($row['uid']));
+               if ($dataMap->getLanguageIdColumnName() !== NULL) {
+                       $object->_setProperty('_languageUid', intval($row[$dataMap->getLanguageIdColumnName()]));
+                       if (isset($row['_LOCALIZED_UID'])) {
+                               $object->_setProperty('_localizedUid', intval($row['_LOCALIZED_UID']));
+                       }
+               }
+               $properties = $object->_getProperties();
+               foreach ($properties as $propertyName => $propertyValue) {
+                       if (!$dataMap->isPersistableProperty($propertyName)) continue;
+                       $columnMap = $dataMap->getColumnMap($propertyName);
+                       $columnName = $columnMap->getColumnName();
+                       $propertyData = $this->reflectionService->getClassSchema($className)->getProperty($propertyName);
+                       $propertyValue = NULL;
+                       if ($row[$columnName] !== NULL) {
+                               switch ($propertyData['type']) {
+                                       case 'integer':
+                                               $propertyValue = (int) $row[$columnName];
+                                       break;
+                                       case 'float':
+                                               $propertyValue = (float) $row[$columnName];
+                                       break;
+                                       case 'boolean':
+                                               $propertyValue = (boolean) $row[$columnName];
+                                       break;
+                                       case 'string':
+                                               $propertyValue = (string) $row[$columnName];
+                                       break;
+                                       case 'array':
+                                               // $propertyValue = $this->mapArray($row[$columnName]); // Not supported, yet!
+                                       break;
+                                       case 'SplObjectStorage':
+                                       case 'Tx_Extbase_Persistence_ObjectStorage':
+                                               $propertyValue = $this->mapResultToPropertyValue($object, $propertyName, $this->fetchRelated($object, $propertyName, $row[$columnName]));
+                                       break;
+                                       default:
+                                               if (($propertyData['type'] === 'DateTime') || in_array('DateTime', class_parents($propertyData['type']))) {
+                                                       $propertyValue = $this->mapDateTime($row[$columnName]);
+                                               } else {
+                                                       $propertyValue = $this->mapResultToPropertyValue($object, $propertyName, $this->fetchRelated($object, $propertyName, $row[$columnName]));
+                                                       // $propertyValue = $this->mapToObject($row[$columnName]); // Not supported, yet!
+                                               }
+                                       break;
+                               }
+                       }
+
+                       if ($propertyValue !== NULL) {
+                               $object->_setProperty($propertyName, $propertyValue);
+                       }
+               }
+       }
+
+       /**
+        * Creates a DateTime from an unix timestamp. If the input is empty
+        * NULL is returned.
+        *
+        * @param integer $timestamp
+        * @return DateTime
+        */
+       protected function mapDateTime($timestamp) {
+               if (empty($timestamp)) { // 0 -> NULL !!!
+                       return NULL;
+               } else {
+                       return new DateTime(date('c', $timestamp));
+               }
+       }
+
+       /**
+        * Fetches a collection of objects related to a property of a parent object
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The object instance this proxy is part of
+        * @param string $propertyName The name of the proxied property in it's parent
+        * @param mixed $fieldValue The raw field value.
+        * @param bool $enableLazyLoading A flag indication if the related objects should be lazy loaded
+        * @param bool $performLanguageOverlay A flag indication if the related objects should be localized
+        * @return Tx_Extbase_Persistence_LazyObjectStorage|Tx_Extbase_Persistence_QueryResultInterface The result
+        */
+       public function fetchRelated(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '', $enableLazyLoading = TRUE) {
+               $columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
+               $propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
+               if ($enableLazyLoading === TRUE && $propertyMetaData['lazy']) {
+                       if ($propertyMetaData['type'] === 'Tx_Extbase_Persistence_ObjectStorage') {
+                               $result = $this->objectManager->create('Tx_Extbase_Persistence_LazyObjectStorage', $parentObject, $propertyName, $fieldValue);
+                       } else {
+                               if (empty($fieldValue)) {
+                                       $result = NULL;
+                               } else {
+                                       $result = $this->objectManager->create('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue);
+                               }
+                       }
+               } else {
+                       $result = $this->fetchRelatedEager($parentObject, $propertyName, $fieldValue);
+               }
+               return $result;
+       }
+
+       /**
+        * Fetches the related objects from the storage backend.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The object instance this proxy is part of
+        * @param string $propertyName The name of the proxied property in it's parent
+        * @param mixed $fieldValue The raw field value.
+        * @param bool $performLanguageOverlay A flag indication if the related objects should be localized
+        * @return void
+        */
+       protected function fetchRelatedEager(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '') {
+               if ($fieldValue === '') return array();
+               $query = $this->getPreparedQuery($parentObject, $propertyName, $fieldValue);
+               return $query->execute();
+       }
+
+       /**
+        * Builds and returns the prepared query, ready to be executed.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject
+        * @param string $propertyName
+        * @param string $fieldValue
+        * @return void
+        */
+       protected function getPreparedQuery(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '') {
+               $columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
+               $type = $this->getType(get_class($parentObject), $propertyName);
+
+               $query = $this->queryFactory->create($type);
+               $query->getQuerySettings()->setRespectStoragePage(FALSE);
+               $query->getQuerySettings()->setRespectSysLanguage(FALSE);
+               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
+                       if ($columnMap->getChildSortByFieldName() !== NULL) {
+                               $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
+                       }
+               } elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+                       $query->setSource($this->getSource($parentObject, $propertyName));
+                       if ($columnMap->getChildSortByFieldName() !== NULL) {
+                               $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
+                       }
+               }
+               $query->matching($this->getConstraint($query, $parentObject, $propertyName, $fieldValue, $columnMap->getRelationTableMatchFields()));
+               return $query;
+       }
+
+       /**
+        * Builds and returns the constraint for multi value properties.
+        *
+        * @param Tx_Extbase_Persistence_QueryInterface $query
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject
+        * @param string $propertyName
+        * @param string $fieldValue
+        * @param array $relationTableMatchFields
+        * @return Tx_Extbase_Persistence_QOM_ConstraintInterface $constraint
+        */
+       protected function getConstraint(Tx_Extbase_Persistence_QueryInterface $query, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '', $relationTableMatchFields = array()) {
+               $columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
+               if ($columnMap->getParentKeyFieldName() !== NULL) {
+                       $constraint = $query->equals($columnMap->getParentKeyFieldName(), $parentObject);
+                       if($columnMap->getParentTableFieldName() !== NULL) {
+                               $constraint = $query->logicalAnd(
+                                       $constraint,
+                                       $query->equals($columnMap->getParentTableFieldName(), $this->getDataMap(get_class($parentObject))->getTableName())
+                                       );
+                       }
+               } else {
+                       $constraint = $query->in('uid', t3lib_div::intExplode(',', $fieldValue));
+               }
+               if (count($relationTableMatchFields) > 0) {
+                       foreach($relationTableMatchFields as $relationTableMatchFieldName => $relationTableMatchFieldValue) {
+                               $constraint = $query->logicalAnd($constraint, $query->equals($relationTableMatchFieldName, $relationTableMatchFieldValue));
+                       }
+               }
+               return $constraint;
+       }
+
+       /**
+        * Builds and returns the source to build a join for a m:n relation.
+        *
+        * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject
+        * @param string $propertyName
+        * @return Tx_Extbase_Persistence_QOM_SourceInterface $source
+        */
+       protected function getSource(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName) {
+               $columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
+               $left = $this->qomFactory->selector(NULL, $columnMap->getRelationTableName());
+               $childClassName = $this->getType(get_class($parentObject), $propertyName);
+               $right = $this->qomFactory->selector($childClassName, $columnMap->getChildTableName());
+               $joinCondition = $this->qomFactory->equiJoinCondition($columnMap->getRelationTableName(), $columnMap->getChildKeyFieldName(), $columnMap->getChildTableName(), 'uid');
+               $source = $this->qomFactory->join(
+                       $left,
+                       $right,
+                       Tx_Extbase_Persistence_QueryInterface::JCR_JOIN_TYPE_INNER,
+                       $joinCondition
+                       );
+               return $source;
+       }
+
+       /**
+        * Returns the given result as property value of the specified property type.
+        *
+        * @param mixed $result The result could be an object or an ObjectStorage
+        * @param array $propertyMetaData The property meta data
+        * @param Tx_Extbase_Persistence_QueryResultInterface|Tx_Extbase_Persistence_LoadingStrategyInterface $result The result
+        * @return void
+        */
+       public function mapResultToPropertyValue(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $result) {
+               if ($result instanceof Tx_Extbase_Persistence_LoadingStrategyIn