[!!! +FEATURE] Extbase (DataMapper, DataMap): Extbase resolves the table name for...
authorJochen Rau <j.rau@web.de>
Tue, 21 Jul 2009 12:44:52 +0000 (12:44 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 21 Jul 2009 12:44:52 +0000 (12:44 +0000)
[~CONF] Extbase: Changed the initialization of the Plugin and Extbase Settings; These are now initialized in the Dispatcher; The Extbase settings are now available through Tx_Extbase_Dispatcher::getSettings(); related to #3665
[+FEATURE] Extbase: The data array of the cObj is availabe through the settings of extbase (this needs further discussion); related to #
[+BUGFIX] Extbase: Fixed FlexFormSettings with section (thanks to Steffen Kamper); Resolves #3949
[+TASK] Extbase: Moved method postProcessSettings() to the Configuration Manager and made it static
[+FEATURE] Extbase: Added generic Domain Models FrontendUser and FrontendUserGroup; added Repository for FrontendUser (not fully functional by now)
[+BUGFIX] Extbase (Argument): Renamed setNewValidatorChain() to setNewValidatorConjunction()
[+TASK] Extbase (URIBuilder): Removed unnecessary require_once statements
[~TASK] Extbase: Changed the handling of storagePid; this setting is now available through the Extbase Settings Tx_Extbase_Dispatcher::getSettings() (this may change in future); related to #3698
[!!! ~CONF] Extbase: The default setting for the storagePid is now 0; related to #3698
[+TASK] Extbase: Moved extractStoragePageId() to the Configuration Manager and renamed it
[+TASK] Extbase (PersistenceManager): Removed the reference to the DataMapper
[+FEATURE] Extbase: Implemented limit and offset for the Query object; resolves #3874
[+BUGFIX] Extbase (Typo3DbBackend: Fixed statement creation of hasValueObject(); resolves #3939
[!!! ~API] Extbase: Removed Typo3Query and its interface; integrated methods in Query object (will be integrated in the extbase settings in the next step)
[+BUGFIX] Extbase (Typo3DbBackend): Fixed issue with question mark in property; resolves #3943

25 files changed:
typo3/sysext/extbase/Classes/Configuration/Manager.php
typo3/sysext/extbase/Classes/Configuration/Source/FlexFormSource.php
typo3/sysext/extbase/Classes/Configuration/Source/TypoScriptSource.php
typo3/sysext/extbase/Classes/Dispatcher.php
typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Domain/Model/FrontendUserGroup.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Domain/Model/FrontendUserRepository.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/DomainObject/AbstractEntity.php
typo3/sysext/extbase/Classes/MVC/Controller/Argument.php
typo3/sysext/extbase/Classes/MVC/Web/Routing/URIBuilder.php
typo3/sysext/extbase/Classes/Persistence/Backend.php
typo3/sysext/extbase/Classes/Persistence/Manager.php
typo3/sysext/extbase/Classes/Persistence/Mapper/ColumnMap.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMap.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/QOM/QueryObjectModel.php
typo3/sysext/extbase/Classes/Persistence/Query.php
typo3/sysext/extbase/Classes/Persistence/QueryFactory.php
typo3/sysext/extbase/Classes/Persistence/QueryResult.php
typo3/sysext/extbase/Classes/Persistence/QuerySettingsInterface.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php
typo3/sysext/extbase/Classes/Persistence/Value.php
typo3/sysext/extbase/Classes/Validation/Validator/StringLengthValidator.php
typo3/sysext/extbase/ext_tables.php

index d5c9b6e..c5e5d71 100644 (file)
  */
 class Tx_Extbase_Configuration_Manager {
 
+       const DEFAULT_STORAGE_PID = 0;
+
        /**
         * Storage for the settings, loaded by loadGlobalSettings()
         *
         * @var array
         */
-       protected $settings = array();
+       protected $settings;
 
        /**
         * The configuration source instances used for loading the raw configuration
         *
         * @var array
         */
-       protected $configurationSources;
+       protected $configurationSources = array();
 
        /**
         * Constructs the configuration manager
         *
-        * @param array $configurationSourcesObjectNames An array of object names of the configuration sources
-        * @internal
+        * @param array $configurationSources An array of configuration sources
         */
-       public function __construct(array $configurationSources = array()) {
-               $this->configurationSources = $configurationSources;
+       public function __construct($configurationSources = NULL) {
+               if (is_array($configurationSources)) {
+                       $this->configurationSources = $configurationSources;
+               }
        }
-
+       
        /**
         * Returns an array with the settings defined for the specified extension.
         *
         * @param string $extensionName Name of the extension to return the settings for
+        * @param string $controllerName Name of the controller to return the settings for
+        * @param string $actionName Name of the action to return the settings for
         * @return array The settings of the specified extension
         * @internal
         */
@@ -79,7 +84,56 @@ class Tx_Extbase_Configuration_Manager {
                }
                return $settings;
        }
+       
+       /**
+        * Loads the Extbase core settings.
+        *
+        * The Extbase settings can be retrieved like any other setting through the
+        * getSettings() method but need to be loaded separately because they are
+        * needed way earlier in the bootstrap than the package's settings.
+        *
+        * @param array $configuration The current incoming extbase configuration
+        * @param tslib_cObj $cObj The current Content Object
+        * @return void
+        */
+       public function loadExtbaseSettings($configuration, $cObj) {
+               $settings = array();
+               $configurationSource = t3lib_div::makeInstance('Tx_Extbase_Configuration_Source_TypoScriptSource');
+               $settings['storagePid'] = $this->getDefaultStoragePageId($cObj);
+               $settings = t3lib_div::array_merge_recursive_overrule($settings, $configurationSource->load('Extbase'));
+               $settings = t3lib_div::array_merge_recursive_overrule($settings, self::postProcessSettings($configuration));
+               $settings['contentObjectData'] = $cObj->data;
+               
+               $this->settings['Extbase'] = $settings;
+       }
+       
+       /**
+        * Extracts the default storage PID from $this->cObj->data['pages']. ONLY ALLOWS ONE STORAGE PID!
+        * If this one is empty, tries to use $this->cObj->data['storage_pid'].  
+        * If this one is empty, tries to use $this->cObj->parentRecord->data['storage_pid']. If all tree  are empty, uses current page.
+        * 
+        * @param tslib_cObj $cObj The current Content Object
+        * @return integer
+        * @throws InvalidArgumentException if more than one storage page ID is given
+        */
+       protected function getDefaultStoragePageId($cObj) {
+               if (is_string($cObj->data['pages'])) {
+                       if (count(explode(',', $cObj->data['pages'])) > 1) {
+                               throw new InvalidArgumentException('More than one storage page ID given. This is currently not supported.', 1247597243);
+                       }
+                       return (int)$cObj->data['pages'];
+               }
 
+               if ($cObj->data['storage_pid'] > 0) {
+                       return (int)$cObj->data['storage_pid'];
+               }
+               
+               if ($cObj->parentRecord->data['storage_pid'] > 0) {
+                       return (int)$cObj->parentRecord->data['storage_pid'];
+               }
+               return self::DEFAULT_STORAGE_PID;
+       }
+       
        /**
         * Loads the settings defined in the specified extensions and merges them with
         * those potentially existing in the global configuration folders.
@@ -99,5 +153,36 @@ class Tx_Extbase_Configuration_Manager {
                }
                $this->settings[$extensionName] = $settings;
        }
+       
+       /**
+        * Removes all trailing dots recursively from TS settings array
+        *
+        * @param array $setup The settings array
+        * @return void
+        */
+       public static function postProcessSettings(array $settings) {
+               $processedSettings = array();
+               foreach ($settings as $key => $value) {
+                       if (substr($key, -1) === '.') {
+                               $keyWithoutDot = substr($key, 0, -1);
+                               $processedSettings[$keyWithoutDot] = self::postProcessSettings($value);
+                               if (array_key_exists($keyWithoutDot, $settings)) {
+                                       $processedSettings[$keyWithoutDot]['_typoScriptNodeValue'] = $settings[$keyWithoutDot];
+                                       unset($settings[$keyWithoutDot]);
+                               }
+                       } else {
+                               $keyWithDot = $key . '.';
+                               if (array_key_exists($keyWithDot, $settings)) {
+                                       $processedSettings[$key] = self::postProcessSettings($settings[$keyWithDot]);
+                                       $processedSettings[$key]['_typoScriptNodeValue'] = $value;
+                                       unset($settings[$keyWithDot]);
+                               } else {
+                                       $processedSettings[$key] = $value;
+                               }
+                       }
+               }
+               return $processedSettings;
+       }
+
 }
 ?>
\ No newline at end of file
index 0e13e77..c9ea156 100644 (file)
@@ -59,22 +59,58 @@ class Tx_Extbase_Configuration_Source_FlexFormSource implements Tx_Extbase_Confi
         * @param string $extensionName The extension name
         * @return array
         */
-        public function load($extensionName) {
+       public function load($extensionName) {
                $settings = array();
-               if (is_array($this->flexFormContent)) {
-                       $flexFormArray = $this->flexFormContent;
-               } elseif (!empty($this->flexFormContent)) {
-                       $flexFormArray = t3lib_div::xml2array($this->flexFormContent);
+               if (!empty($this->flexFormContent)) {
+                       $this->readFlexformIntoConf($this->flexFormContent, $settings);
                }
-               // TODO Support for different languages
-               $sheetArray = $flexFormArray['data']['sDEF']['lDEF'];
-               if (is_array($sheetArray))      {
-                       foreach($sheetArray as $key => $value) {
-                               $settings[$key] = $value['vDEF'];
+               
+               
+               return $settings;
+       }
+       
+       /**
+        * Parses the FlexForm content recursivly and adds it to the configuration
+        * 
+        * @param $flexFormContent
+        * @param array $settings
+        * @param boolean $recursive
+        * @return void
+        */
+       private function readFlexformIntoConf($flexFormContent, &$settings, $recursive = FALSE) {
+               // TODO Do we need the $recursive argument here?
+               if ($recursive === FALSE) {
+                       $flexFormContent = t3lib_div::xml2array($flexFormContent, 'T3'); 
+               } 
+
+               if (is_array($flexFormContent)) {
+                       if (isset($flexFormContent['data']['sDEF']['lDEF'])) {
+                               $flexFormContent = $flexFormContent['data']['sDEF']['lDEF'];
+                       }
+                       
+                       foreach ($flexFormContent as $key => $value) {
+                               if (is_array($value['el']) && count($value['el']) > 0) {
+                                       foreach ($value['el'] as $ekey => $element) {
+                                               if (isset($element['vDEF'])) {
+                                                       $settings[$ekey] =  $element['vDEF'];
+                                               } else {
+                                                       if(is_array($element)) {
+                                                               $this->readFlexformIntoConf($element, $settings[$key][key($element)][$ekey], TRUE);
+                                                       } else {
+                                                               $this->readFlexformIntoConf($element, $settings[$key][$ekey], TRUE);
+                                                       }
+                                               }
+                                       }
+                               } else {
+                                       $this->readFlexformIntoConf($value['el'], $settings[$key], TRUE);
+                               }
+                               if ($value['vDEF']) {
+                                       $settings[$key] = $value['vDEF'];
+                               }
                        }
                }
-               return $settings;
        }
+       
 
 }
 ?>
\ No newline at end of file
index 6352822..b35ce65 100644 (file)
@@ -43,42 +43,12 @@ class Tx_Extbase_Configuration_Source_TypoScriptSource implements Tx_Extbase_Con
                // TODO Needs a FE (does actually not work with BE or CLI)
                $settings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_' . strtolower($extensionName) . '.'];
                if (is_array($settings)) {
-                       $settings = $this->postProcessSettings($settings);
+                       $settings = Tx_Extbase_Configuration_Manager::postProcessSettings($settings);
                } else {
                        $settings = array();
                }
                return $settings;
        }
-       
-       /**
-        * Removes all trailing dots recursively from TS settings array
-        *
-        * @param array $setup The settings array
-        * @return void
-        */
-       protected function postProcessSettings(array $settings) {
-               $processedSettings = array();
-               foreach ($settings as $key => $value) {
-                       if (substr($key, -1) === '.') {
-                               $keyWithoutDot = substr($key, 0, -1);
-                               $processedSettings[$keyWithoutDot] = $this->postProcessSettings($value);
-                               if (array_key_exists($keyWithoutDot, $settings)) {
-                                       $processedSettings[$keyWithoutDot]['_typoScriptNodeValue'] = $settings[$keyWithoutDot];
-                                       unset($settings[$keyWithoutDot]);
-                               }
-                       } else {
-                               $keyWithDot = $key . '.';
-                               if (array_key_exists($keyWithDot, $settings)) {
-                                       $processedSettings[$key] = $this->postProcessSettings($settings[$keyWithDot]);
-                                       $processedSettings[$key]['_typoScriptNodeValue'] = $value;
-                                       unset($settings[$keyWithDot]);
-                               } else {
-                                       $processedSettings[$key] = $value;
-                               }
-                       }
-               }
-               return $processedSettings;
-       }
-       
+               
 }
 ?>
\ No newline at end of file
index 7ac34a1..0ae7eb2 100644 (file)
  * @version $ID:$
  */
 class Tx_Extbase_Dispatcher {
+               
+       /**
+        * @var Tx_Extbase_Configuration_Manager
+        */
+       protected $configurationManager;
        
        /**
         * @var Tx_Extbase_Reflection_Service
         */
-       protected $reflectionService;
+       protected static $reflectionService;
 
        /**
         * @var Tx_Extbase_Persistence_Manager
@@ -43,6 +48,12 @@ class Tx_Extbase_Dispatcher {
        private static $persistenceManager;
 
        /**
+        * The settings for the Extbase framework
+        * @var array
+        */
+       private static $settings;
+
+       /**
         * Creates a request an dispatches it to a controller.
         *
         * @param string $content The content
@@ -54,13 +65,14 @@ class Tx_Extbase_Dispatcher {
                        t3lib_div::sysLog('Extbase was not able to dispatch the request. No configuration.', 'extbase', t3lib_div::SYSLOG_SEVERITY_ERROR);
                        return $content;
                }
-               
+               $this->initializeConfiguration($configuration);
+                               
                $requestBuilder = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_RequestBuilder');
                $request = $requestBuilder->initialize($configuration);
                $request = $requestBuilder->build();
                $response = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Response');
 
-               $persistenceManager = self::getPersistenceManager($configuration, $this->extractStoragePageId());
+               $persistenceManager = self::getPersistenceManager($configuration);
 
                $dispatchLoopCount = 0;
                while (!$request->isDispatched()) {
@@ -75,38 +87,31 @@ class Tx_Extbase_Dispatcher {
                }
 
                $persistenceManager->persistAll();
-               $this->reflectionService->shutdown();
+               self::$reflectionService->shutdown();
                if (count($response->getAdditionalHeaderData()) > 0) {
                        $GLOBALS['TSFE']->additionalHeaderData[$request->getControllerExtensionName()] = implode("\n", $response->getAdditionalHeaderData());
                }
                $response->sendHeaders();
                return $response->getContent();
        }
-
+       
        /**
-        * Extracts the storage PID from $this->cObj->data['pages']. ONLY ALLOWS ONE STORAGE PID!
-        * If this one is empty, tries to use $this->cObj->data['storage_pid'].  
-        * If this one is empty, tries to use $this->cObj->parentRecord->data['storage_pid']. If all tree  are empty, uses current page.
-        * 
-        * @return integer
-        * @throws InvalidArgumentException if more than one storage page ID is given
+        * Initializes the configuration manager and the Extbase settings
+        *
+        * @param $configuration The current incoming configuration
+        * @return void
         */
-       protected function extractStoragePageId() {
-               if (is_string($this->cObj->data['pages'])) {
-                       if (count(explode(',', $this->cObj->data['pages'])) > 1) {
-                               throw new InvalidArgumentException('More than one storage page ID given. This is currently not supported.', 1247597243);
-                       }
-                       return (int)$this->cObj->data['pages'];
-               }
-
-               if ($this->cObj->data['storage_pid'] > 0) {
-                       return (int)$this->cObj->data['storage_pid'];
-               }
-               
-               if ($this->cObj->parentRecord->data['storage_pid'] > 0) {
-                       return (int)$this->cObj->parentRecord->data['storage_pid'];
+       protected function initializeConfiguration($configuration) {
+               $configurationSources = array();
+               $configurationSources[] = t3lib_div::makeInstance('Tx_Extbase_Configuration_Source_TypoScriptSource');
+               if (!empty($this->cObj->data['pi_flexform'])) {
+                       $configurationSource = t3lib_div::makeInstance('Tx_Extbase_Configuration_Source_FlexFormSource');
+                       $configurationSource->setFlexFormContent($this->cObj->data['pi_flexform']);
+                       $configurationSources[] = $configurationSource;
                }
-               return $GLOBALS['TSFE']->id;
+               $this->configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_Manager', $configurationSources);
+               $this->configurationManager->loadExtbaseSettings($configuration, $this->cObj);
+               self::$settings = $this->configurationManager->getSettings('Extbase');
        }
        
        /**
@@ -123,11 +128,11 @@ class Tx_Extbase_Dispatcher {
                }
                $propertyMapper = t3lib_div::makeInstance('Tx_Extbase_Property_Mapper');
                $controller->injectPropertyMapper($propertyMapper);
-               $controller->injectSettings($this->getSettings($request));
+               $controller->injectSettings($this->configurationManager->getSettings($request->getControllerExtensionName()));
                $cacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
-               $this->reflectionService = t3lib_div::makeInstance('Tx_Extbase_Reflection_Service');
+               self::$reflectionService = t3lib_div::makeInstance('Tx_Extbase_Reflection_Service');
                try {
-                       $this->reflectionService->setCache($cacheManager->getCache('Tx_Extbase_Reflection'));
+                       self::$reflectionService->setCache($cacheManager->getCache('Tx_Extbase_Reflection'));
                } catch (t3lib_cache_exception_NoSuchCache $exception) {
                        $cacheFactory = t3lib_div::makeInstance('t3lib_cache_Factory');
                        $cacheFactory->create(
@@ -136,50 +141,29 @@ class Tx_Extbase_Dispatcher {
                                $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['Tx_Extbase_Reflection']['backend'],
                                $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['Tx_Extbase_Reflection']['options']
                        );
-                       $this->reflectionService->setCache($cacheManager->getCache('Tx_Extbase_Reflection'));
+                       self::$reflectionService->setCache($cacheManager->getCache('Tx_Extbase_Reflection'));
                }
-               if (!$this->reflectionService->isInitialized()) {
-                       $this->reflectionService->initialize();
+               if (!self::$reflectionService->isInitialized()) {
+                       self::$reflectionService->initialize();
                }
                $validatorResolver = t3lib_div::makeInstance('Tx_Extbase_Validation_ValidatorResolver');
                $validatorResolver->injectObjectManager(t3lib_div::makeInstance('Tx_Extbase_Object_Manager'));
-               $validatorResolver->injectReflectionService($this->reflectionService);
+               $validatorResolver->injectReflectionService(self::$reflectionService);
                $controller->injectValidatorResolver($validatorResolver);
-               $controller->injectReflectionService($this->reflectionService);
+               $controller->injectReflectionService(self::$reflectionService);
                return $controller;
        }
 
        /**
-        * Builds the settings by overlaying TS Setup with FlexForm values of the extension
-        * and returns them as a plain array (with no trailing dots).
-        *
-        * @param Tx_Extbase_MVC_Web_Request $request
-        * @return array The settings array
-        */
-       protected function getSettings(Tx_Extbase_MVC_Web_Request $request) {
-               $extensionName = $request->getControllerExtensionName();
-               $configurationSources = array();
-               $configurationSources[] = t3lib_div::makeInstance('Tx_Extbase_Configuration_Source_TypoScriptSource');
-               if (!empty($this->cObj->data['pi_flexform'])) {
-                       $configurationSource = t3lib_div::makeInstance('Tx_Extbase_Configuration_Source_FlexFormSource');
-                       $configurationSource->setFlexFormContent($this->cObj->data['pi_flexform']);
-                       $configurationSources[] = $configurationSource;
-               }
-               $configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_Manager', $configurationSources);
-               return $configurationManager->getSettings($extensionName);
-       }
-
-       /**
         * This function prepares and returns the Persistance Manager
         *
         * @param array $configuration The given configuration
         * @param integer $storagePageId Storage page ID to to read and write records.
         * @return Tx_Extbase_Persistence_Manager A (singleton) instance of the Persistence Manager
         */
-       public static function getPersistenceManager(array $configuration = array(), $storagePageId = 0) {
+       public static function getPersistenceManager(array $configuration = array()) {
                if (self::$persistenceManager === NULL) {
                        $queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory'); // singleton
-                       $queryFactory->setStoragePageId($storagePageId);
                        
                        $persistenceSession = t3lib_div::makeInstance('Tx_Extbase_Persistence_Session'); // singleton
                        $storageBackend = t3lib_div::makeInstance('Tx_Extbase_Persistence_Storage_Typo3DbBackend', $GLOBALS['TYPO3_DB']); // singleton
@@ -190,7 +174,7 @@ class Tx_Extbase_Dispatcher {
                        }
                        $dataMapper = t3lib_div::makeInstance('Tx_Extbase_Persistence_Mapper_DataMapper'); // singleton
 
-                       $persistenceBackend = t3lib_div::makeInstance('Tx_Extbase_Persistence_Backend', $persistenceSession, $storageBackend, $storagePageId); // singleton
+                       $persistenceBackend = t3lib_div::makeInstance('Tx_Extbase_Persistence_Backend', $persistenceSession, $storageBackend); // singleton
                        $persistenceBackend->injectDataMapper($dataMapper);
                        $persistenceBackend->injectIdentityMap(t3lib_div::makeInstance('Tx_Extbase_Persistence_IdentityMap'));
                        $persistenceBackend->injectQOMFactory(t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_QueryObjectModelFactory', $storageBackend, $dataMapper));
@@ -205,6 +189,16 @@ class Tx_Extbase_Dispatcher {
 
                return self::$persistenceManager;
        }
+       
+       /**
+        * This function returns the settings of Extbase
+        *
+        * @return array The settings
+        */
+       public static function getSettings() {
+               return self::$settings;
+       }
+       
 
        /**
         * Loads php files containing classes or interfaces found in the classes directory of
diff --git a/typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php b/typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php
new file mode 100644 (file)
index 0000000..ef92f99
--- /dev/null
@@ -0,0 +1,476 @@
+<?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 Frontend User
+ *
+ * @package Extbase
+ * @subpackage Domain
+ * @version $Id: $
+ * @scope prototype
+ * @entity
+ */
+class Tx_Extbase_Domain_Model_FrontendUser extends Tx_Extbase_DomainObject_AbstractEntity {
+
+       /**
+        * @var string
+        */
+       protected $username;
+
+       /**
+        * @var string
+        */
+       protected $password;
+
+       /**
+        * @var Tx_Extbase_Domain_Model_FrontendUserGroup
+        */
+//     protected $usergroup;
+
+       /**
+        * @var string
+        */
+       protected $name;
+
+       /**
+        * @var string
+        */
+       protected $address;
+
+       /**
+        * @var string
+        */
+       protected $telephone;
+
+       /**
+        * @var string
+        */
+       protected $fax;
+
+       /**
+        * @var string
+        */
+       protected $email;
+
+       /**
+        * @var string
+        */
+       protected $lockToDomain;
+
+       /**
+        * @var string
+        */
+       protected $title;
+
+       /**
+        * @var string
+        */
+       protected $zip;
+
+       /**
+        * @var string
+        */
+       protected $city;
+
+       /**
+        * @var string
+        */
+       protected $country;
+
+       /**
+        * @var string
+        */
+       protected $www;
+
+       /**
+        * @var string
+        */
+       protected $company;
+
+       /**
+        * @var string
+        */
+       protected $image;
+
+       /**
+        * @var DateTime
+        */
+       protected $lastlogin;
+
+       /**
+        * @var DateTime
+        */
+       protected $isOnline;
+
+       /**
+        * Constructs a new Front-End User
+        *
+        */
+       public function __construct($username, $password) {
+       }
+       
+       /**
+        * Sets the username value
+        *
+        * @param string $username
+        * @return void
+        */
+       public function setUsername($username) {
+               $this->username = $username;
+       }
+       
+       /**
+        * Returns the username value
+        *
+        * @return string
+        */
+       public function getUsername() {
+               return $this->username;
+       }
+       
+       /**
+        * Sets the password value
+        *
+        * @param string $password
+        * @return void
+        */
+       public function setPassword($password) {
+               $this->password = $password;
+       }
+       
+       /**
+        * Returns the password value
+        *
+        * @return string
+        */
+       public function getPassword() {
+               return $this->password;
+       }
+       
+       /**
+        * Sets the usergroup value
+        *
+        * @param Tx_Extbase_Domain_Model_FrontendUserGroup $usergroup
+        * @return void
+        */
+       public function setUsergroup(Tx_Extbase_Domain_Model_FrontendUserGroup $usergroup) {
+               $this->usergroup = $usergroup;
+       }
+       
+       /**
+        * Returns the usergroup value
+        *
+        * @return Tx_Extbase_Domain_Model_FrontendUserGroup
+        */
+       public function getUsergroup() {
+               return $this->usergroup;
+       }
+       
+       /**
+        * Sets the name value
+        *
+        * @param string $name
+        * @return void
+        */
+       public function setName($name) {
+               $this->name = $name;
+       }
+       
+       /**
+        * Returns the name value
+        *
+        * @return string
+        */
+       public function getName() {
+               return $this->name;
+       }
+       
+       /**
+        * Sets the address value
+        *
+        * @param string $address
+        * @return void
+        */
+       public function setAddress($address) {
+               $this->address = $address;
+       }
+       
+       /**
+        * Returns the address value
+        *
+        * @return string
+        */
+       public function getAddress() {
+               return $this->address;
+       }
+       
+       /**
+        * Sets the telephone value
+        *
+        * @param string $telephone
+        * @return void
+        */
+       public function setTelephone($telephone) {
+               $this->telephone = $telephone;
+       }
+       
+       /**
+        * Returns the telephone value
+        *
+        * @return string
+        */
+       public function getTelephone() {
+               return $this->telephone;
+       }
+       
+       /**
+        * Sets the fax value
+        *
+        * @param string $fax
+        * @return void
+        */
+       public function setFax($fax) {
+               $this->fax = $fax;
+       }
+       
+       /**
+        * Returns the fax value
+        *
+        * @return string
+        */
+       public function getFax() {
+               return $this->fax;
+       }
+       
+       /**
+        * Sets the email value
+        *
+        * @param string $email
+        * @return void
+        */
+       public function setEmail($email) {
+               $this->email = $email;
+       }
+       
+       /**
+        * Returns the email value
+        *
+        * @return string
+        */
+       public function getEmail() {
+               return $this->email;
+       }
+       
+       /**
+        * Sets the lockToDomain value
+        *
+        * @param string $lockToDomain
+        * @return void
+        */
+       public function setLockToDomain($lockToDomain) {
+               $this->lockToDomain = $lockToDomain;
+       }
+       
+       /**
+        * Returns the lockToDomain value
+        *
+        * @return string
+        */
+       public function getLockToDomain() {
+               return $this->lockToDomain;
+       }
+       
+       /**
+        * Sets the title value
+        *
+        * @param string $title
+        * @return void
+        */
+       public function setTitle($title) {
+               $this->title = $title;
+       }
+       
+       /**
+        * Returns the title value
+        *
+        * @return string
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * Sets the zip value
+        *
+        * @param string $zip
+        * @return void
+        */
+       public function setZip($zip) {
+               $this->zip = $zip;
+       }
+       
+       /**
+        * Returns the zip value
+        *
+        * @return string
+        */
+       public function getZip() {
+               return $this->zip;
+       }
+       
+       /**
+        * Sets the city value
+        *
+        * @param string $city
+        * @return void
+        */
+       public function setCity($city) {
+               $this->city = $city;
+       }
+       
+       /**
+        * Returns the city value
+        *
+        * @return string
+        */
+       public function getCity() {
+               return $this->city;
+       }
+       
+       /**
+        * Sets the country value
+        *
+        * @param string $country
+        * @return void
+        */
+       public function setCountry($country) {
+               $this->country = $country;
+       }
+       
+       /**
+        * Returns the country value
+        *
+        * @return string
+        */
+       public function getCountry() {
+               return $this->country;
+       }
+       
+       /**
+        * Sets the www value
+        *
+        * @param string $www
+        * @return void
+        */
+       public function setWww($www) {
+               $this->www = $www;
+       }
+       
+       /**
+        * Returns the www value
+        *
+        * @return string
+        */
+       public function getWww() {
+               return $this->www;
+       }
+       
+       /**
+        * Sets the company value
+        *
+        * @param string $company
+        * @return void
+        */
+       public function setCompany($company) {
+               $this->company = $company;
+       }
+       
+       /**
+        * Returns the company value
+        *
+        * @return string
+        */
+       public function getCompany() {
+               return $this->company;
+       }
+       
+       /**
+        * Sets the image value
+        *
+        * @param string $image
+        * @return void
+        */
+       public function setImage($image) {
+               $this->image = $image;
+       }
+       
+       /**
+        * Returns the image value
+        *
+        * @return string
+        */
+       public function getImage() {
+               return $this->image;
+       }
+       
+       /**
+        * Sets the lastLogin value
+        *
+        * @param DateTime $lastLogin
+        * @return void
+        */
+       public function setLastLogin($lastLogin) {
+               $this->lastLogin = $lastLogin;
+       }
+       
+       /**
+        * Returns the lastLogin value
+        *
+        * @return DateTime
+        */
+       public function getLastLogin() {
+               return $this->lastLogin;
+       }
+       
+       /**
+        * Sets the isOnline value
+        *
+        * @param DateTime $isOnline
+        * @return void
+        */
+       public function setIsOnline($isOnline) {
+               $this->isOnline = $isOnline;
+       }
+       
+       /**
+        * Returns the isOnline value
+        *
+        * @return DateTime
+        */
+       public function getIsOnline() {
+               return $this->isOnline;
+       }
+       
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Domain/Model/FrontendUserGroup.php b/typo3/sysext/extbase/Classes/Domain/Model/FrontendUserGroup.php
new file mode 100644 (file)
index 0000000..1b2cec8
--- /dev/null
@@ -0,0 +1,140 @@
+<?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 Frontend User Group
+ *
+ * @package Extbase
+ * @subpackage Domain
+ * @version $Id: $
+ * @scope prototype
+ * @entity
+ */
+class Tx_Extbase_Domain_Model_FrontendUserGroup extends Tx_Extbase_DomainObject_AbstractEntity {
+       
+       /**
+        * @var string
+        */
+       protected $title;
+
+       /**
+        * @var string
+        */
+       protected $lockToDomain;
+
+       /**
+        * @var string
+        */
+       protected $description;
+
+       /**
+        * @var string
+        */
+//     protected $subgroup;
+
+       /**
+        * Constructs a new Frontend User Group
+        *
+        */
+       public function __construct($title) {
+       }
+       
+       /**
+        * Sets the title value
+        *
+        * @param string $title
+        * @return void
+        */
+       public function setTitle($title) {
+               $this->title = $title;
+       }
+       
+       /**
+        * Returns the title value
+        *
+        * @return string
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * Sets the lockToDomain value
+        *
+        * @param string $lockToDomain
+        * @return void
+        */
+       public function setLockToDomain($lockToDomain) {
+               $this->lockToDomain = $lockToDomain;
+       }
+       
+       /**
+        * Returns the lockToDomain value
+        *
+        * @return string
+        */
+       public function getLockToDomain() {
+               return $this->lockToDomain;
+       }
+       
+       /**
+        * Sets the description value
+        *
+        * @param string $description
+        * @return void
+        */
+       public function setDescription($description) {
+               $this->description = $description;
+       }
+       
+       /**
+        * Returns the description value
+        *
+        * @return string
+        */
+       public function getDescription() {
+               return $this->description;
+       }
+       
+       /**
+        * Sets the subgroup value
+        *
+        * @param Tx_Extbase_Domain_Model_FrontendUserGroup $subgroup
+        * @return void
+        */
+       public function setSubgroup($subgroup) {
+               $this->subgroup = $subgroup;
+       }
+       
+       /**
+        * Returns the subgroup value
+        *
+        * @return Tx_Extbase_Domain_Model_FrontendUserGroup
+        */
+       public function getSubgroup() {
+               return $this->subgroup;
+       }
+       
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Domain/Model/FrontendUserRepository.php b/typo3/sysext/extbase/Classes/Domain/Model/FrontendUserRepository.php
new file mode 100644 (file)
index 0000000..056e92f
--- /dev/null
@@ -0,0 +1,35 @@
+<?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 Frontend User repository
+ *
+ * @package Extbase
+ * @subpackage Domain
+ * @version $Id: $
+ */
+class Tx_Extbase_Domain_Model_FrontendUserRepository extends Tx_Extbase_Persistence_Repository {
+       
+}
+?>
\ No newline at end of file
index 22a4c45..39d34cd 100644 (file)
@@ -75,8 +75,6 @@ abstract class Tx_Extbase_DomainObject_AbstractEntity extends Tx_Extbase_DomainO
                        $this->_cleanProperties = array();
                }
                if (is_object($propertyValue)) {
-                       // SK: Is "clone" semantically correct here? Discussion needed.
-                       // FIXME If you see "getDirtyProperties", there you compare with ===, so cloned objects will return a different value I think (but needs to be verified)
                        $this->_cleanProperties[$propertyName] = clone($propertyValue);
                } else {
                        $this->_cleanProperties[$propertyName] = $propertyValue;
index 24db481..7a97124 100644 (file)
@@ -110,8 +110,7 @@ class Tx_Extbase_MVC_Controller_Argument {
                if (!is_string($name) || strlen($name) < 1) throw new InvalidArgumentException('$name must be of type string, ' . gettype($name) . ' given.', 1187951688);
                $this->name = $name;
                if (is_array($dataType)) {
-                       // SK setNewValidatorChain does not exist! I think this needs to be changed to setNewValidatorConjunction.
-                       $this->setNewValidatorChain($dataType);
+                       $this->setNewValidatorConjunction($dataType);
                } else {
                        $this->setDataType($dataType);
                }
index 127fa93..5b3c7f7 100644 (file)
@@ -12,9 +12,6 @@
  * Public License for more details.                                       *
  *                                                                        */
 
-require_once(PATH_t3lib . 'interfaces/interface.t3lib_singleton.php');
-require_once(PATH_tslib . 'class.tslib_content.php');
-
 /**
  * An URI Builder
  *
index f333caf..70723c4 100644 (file)
@@ -88,13 +88,14 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
         *
         * @param Tx_Extbase_Persistence_Session $session The persistence session used to persist data
         */
-       public function __construct(Tx_Extbase_Persistence_Session $session, Tx_Extbase_Persistence_Storage_BackendInterface $storageBackend, $storagePageId) {
+       public function __construct(Tx_Extbase_Persistence_Session $session, Tx_Extbase_Persistence_Storage_BackendInterface $storageBackend) {
                $this->session = $session;
                $this->storageBackend = $storageBackend;
                $this->referenceIndex = t3lib_div::makeInstance('t3lib_refindex');
                $this->aggregateRootObjects = new Tx_Extbase_Persistence_ObjectStorage();
                $this->persistenceBackend = $GLOBALS['TYPO3_DB']; // FIXME This is just an intermediate solution
-               $this->storagePageId = $storagePageId;
+               $extbaseSettings = Tx_Extbase_Dispatcher::getSettings();
+               $this->storagePageId = $extbaseSettings['storagePid'];
        }
 
        /**
@@ -288,7 +289,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
 
                // Fill up $row[$columnName] array with changed values which need to be stored
                foreach ($properties as $propertyName => $propertyValue) {
-                       if ($dataMap->isPersistableProperty($propertyName) && ($propertyValue instanceof Tx_Extbase_Persistence_LazyLoadingProxy)) {
+                       if (!$dataMap->isPersistableProperty($propertyName) || ($propertyValue instanceof Tx_Extbase_Persistence_LazyLoadingProxy)) {
                                continue;
                        }
 
@@ -304,7 +305,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                                        } elseif ($propertyValue instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
                                                // TODO Handle Value Objects different
                                                // SK: this is the case RELATION_HAS_ONE, correct?
-                                               if ($propertyValue->_isNew()) {
+                                               if ($propertyValue->_isNew() || $propertyValue->_isDirty()) {
                                                        // SK: What happens if the value is not new, but changed?
                                                        $this->persistObject($propertyValue);
                                                }
index 554f5f4..82c5ede 100644 (file)
@@ -46,11 +46,6 @@ class Tx_Extbase_Persistence_Manager implements Tx_Extbase_Persistence_ManagerIn
        protected $session;
 
        /**
-        * @var Tx_Extbase_Persistence_DataMapper
-        */
-       protected $dataMapper;
-
-       /**
         * Injects the persistence backend
         *
         * @param Tx_Extbase_Persistence_BackendInterface $backend The persistence backend
@@ -83,16 +78,6 @@ class Tx_Extbase_Persistence_Manager implements Tx_Extbase_Persistence_ManagerIn
        }
 
        /**
-        * Returns the current Data Mapper
-        *
-        * @return Tx_Extbase_Persistence_Mapper_DataMapper
-        * @internal
-        */
-       public function getDataMapper() {
-               return $this->dataMapper;
-       }
-
-       /**
         * Returns the persistence backend
         *
         * @return Tx_Extbase_Persistence_BackendInterface
index 9b6806d..18187e8 100644 (file)
@@ -123,10 +123,17 @@ class Tx_Extbase_Persistence_Mapper_ColumnMap {
         **/
        protected $parentTableFieldName;
 
-       public function __construct($columnName) {
+       /**
+        * 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(t3lib_div::underscoredToLowerCamelCase($columnName));
+               $this->setPropertyName($propertyName);
        }
 
        public function setTypeOfRelation($typeOfRelation) {
@@ -163,7 +170,7 @@ class Tx_Extbase_Persistence_Mapper_ColumnMap {
                                $this->propertyType = $propertyType;
                                break;
                        default:
-                               $this->propertyType = NULL; // TODO
+                               $this->propertyType = Tx_Extbase_Persistence_PropertyType::UNDEFINED;
                                break;
                }
        }
index 1be75f7..a148dba 100644 (file)
@@ -57,14 +57,14 @@ class Tx_Extbase_Persistence_Mapper_DataMap {
         * @param string $className The class name. This determines the table to fetch the configuration for
         */
        // TODO Refactor to factory pattern (DataMapFactory) and value object (DataMap)  
-       public function __construct($className, $tableName = '') {
+       public function __construct($className, $tableName = '', array $mapping = array()) {
                $this->setClassName($className);
                if (empty($tableName)) {
                        $this->setTableName(strtolower($className));
                } else {
                        $this->setTableName($tableName);
                }
-               $this->initialize();
+               $this->initialize($mapping);
        }
 
        /**
@@ -110,24 +110,27 @@ class Tx_Extbase_Persistence_Mapper_DataMap {
         *
         * @return void
         */
-       protected function initialize() {
+       protected function initialize(array $mapping) {
                t3lib_div::loadTCA($this->getTableName());
                $columns = $GLOBALS['TCA'][$this->getTableName()]['columns'];
                $this->addCommonColumns();
                if (is_array($columns)) {
                        foreach ($columns as $columnName => $columnConfiguration) {
-                               // TODO convert underscore column names to lowercamelcase
-                               $columnMap = new Tx_Extbase_Persistence_Mapper_ColumnMap($columnName, $this);
+                               if (!empty($mapping[$columnName]['mapOnProperty'])) {
+                                       $propertyName = $mapping[$columnName]['mapOnProperty'];
+                               } else {
+                                       $propertyName = t3lib_div::underscoredToLowerCamelCase($columnName);
+                               }
+                               $columnMap = new Tx_Extbase_Persistence_Mapper_ColumnMap($columnName, $propertyName);
                                $this->setPropertyType($columnMap, $columnConfiguration);
-                               // TODO support for IRRE
+                               // TODO Check support for IRRE
                                // TODO support for MM_insert_fields and MM_match_fields
-                               // SK: are the above TODOs still valid?
                                $this->setRelations($columnMap, $columnConfiguration);
                                $this->addColumnMap($columnMap);
                        }
                }
        }
-
+       
        /**
         * Adds available common columns (e.g. tstamp or crdate) to the data map. It takes the configured column names
         * into account.
@@ -136,22 +139,24 @@ class Tx_Extbase_Persistence_Mapper_DataMap {
         */
        protected function addCommonColumns() {
                // TODO Decide whether we should add pid and uid columns by default
-               $this->addColumn('uid', Tx_Extbase_Persistence_PropertyType::LONG);
-               $this->addColumn('pid', Tx_Extbase_Persistence_PropertyType::LONG);
+               $this->addColumn('uid', NULL, Tx_Extbase_Persistence_PropertyType::LONG);
+               if ($this->hasPidColumn()) {
+                       $this->addColumn('pid', NULL, Tx_Extbase_Persistence_PropertyType::LONG);
+               }
                if ($this->hasTimestampColumn()) {
-                       $this->addColumn($this->getTimestampColumnName(), Tx_Extbase_Persistence_PropertyType::DATE);
+                       $this->addColumn($this->getTimestampColumnName(), NULL, Tx_Extbase_Persistence_PropertyType::DATE);
                }
                if ($this->hasCreationDateColumn()) {
-                       $this->addColumn($this->getCreationDateColumnName(), Tx_Extbase_Persistence_PropertyType::DATE);
+                       $this->addColumn($this->getCreationDateColumnName(), NULL, Tx_Extbase_Persistence_PropertyType::DATE);
                }
                if ($this->hasCreatorUidColumn()) {
-                       $this->addColumn($this->getCreatorUidColumnName(), Tx_Extbase_Persistence_PropertyType::LONG);
+                       $this->addColumn($this->getCreatorUidColumnName(), NULL, Tx_Extbase_Persistence_PropertyType::LONG);
                }
                if ($this->hasDeletedColumn()) {
-                       $this->addColumn($this->getDeletedColumnName(), Tx_Extbase_Persistence_PropertyType::BOOLEAN);
+                       $this->addColumn($this->getDeletedColumnName(), NULL, Tx_Extbase_Persistence_PropertyType::BOOLEAN);
                }
                if ($this->hasHiddenColumn()) {
-                       $this->addColumn($this->getHiddenColumnName(), Tx_Extbase_Persistence_PropertyType::BOOLEAN);
+                       $this->addColumn($this->getHiddenColumnName(), NULL, Tx_Extbase_Persistence_PropertyType::BOOLEAN);
                }
        }
 
@@ -174,7 +179,7 @@ class Tx_Extbase_Persistence_Mapper_DataMap {
                } elseif (in_array('double2', $evalConfiguration)) {
                        $columnMap->setPropertyType(Tx_Extbase_Persistence_PropertyType::DOUBLE);
                } else {
-                       if (isset($columnConfiguration['config']['foreign_table'])) {
+                       if (isset($columnConfiguration['config']['foreign_table']) && isset($columnConfiguration['config']['foreign_class'])) {
                                if ($columnConfiguration['config']['loadingStrategy'] === 'proxy') {
                                        $columnMap->setLoadingStrategy(Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_PROXY);
                                } else {
@@ -250,12 +255,17 @@ class Tx_Extbase_Persistence_Mapper_DataMap {
         * relation (optional) and adds it to the data map.
         *
         * @param string $columnName The column name
+        * @param string $propertyName The property name
         * @param string $propertyType The type of value (default: string)
         * @param string $typeOfRelation The type of relation (default: none)
         * @return Tx_Extbase_Persistence_Mapper_DataMap Returns itself for a fluent interface
         */
-       public function addColumn($columnName, $propertyType = Tx_Extbase_Persistence_PropertyType::STRING, $typeOfRelation = Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_NONE) {
-               $columnMap = new Tx_Extbase_Persistence_Mapper_ColumnMap($columnName);
+       public function addColumn($columnName, $propertyName = '', $propertyType = Tx_Extbase_Persistence_PropertyType::STRING, $typeOfRelation = Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_NONE) {
+               if (empty($propertyName)) {
+                       $propertyName = t3lib_div::underscoredToLowerCamelCase($columnName);
+               }
+               
+               $columnMap = new Tx_Extbase_Persistence_Mapper_ColumnMap($columnName, $propertyName);
                $columnMap->setPropertyType($propertyType);
                $columnMap->setTypeOfRelation($typeOfRelation);
                $this->addColumnMap($columnMap);
index e4ecca5..77ea041 100644 (file)
@@ -275,20 +275,23 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
        public function getDataMap($className) {
                global $TCA;
                if (empty($this->dataMaps[$className])) {
-//                     // TODO This is a little bit costy for table name aliases -> implement a DataMapBuilder (knowing the aliases defined in $TCA)
-//                     $tableName = '';
-//                     if (is_array($TCA[strtolower($className)] && empty($TCA[strtolower($className)]['config']['classes']))) {
-//                             $tableName = strtolower($className);
-//                     } else {
-//                                             debug($TCA);
-//
-//                             foreach ($TCA as $configuredTableName => $tableConfiguration) {
-//                                     if (in_array($className, t3lib_div::trimExplode(',', $tableConfiguration['config']['classes']))) {
-//                                             $tableName = $configuredTableName;
-//                                     }
-//                             }
-//                     }
-                       $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap($className, $tableName);
+                       // FIXME This is a costy for table name aliases -> implement a DataMapBuilder (knowing the aliases defined in $TCA)
+                       $mapping = array();
+                       $extbaseSettings = Tx_Extbase_Dispatcher::getSettings();
+                       if (isset($extbaseSettings['classes'][$className]) && !empty($extbaseSettings['classes'][$className]['mapping']['tableName'])) {
+                               $tableName = $extbaseSettings['classes'][$className]['mapping']['tableName'];
+                       } else {
+                               foreach (class_parents($className) as $parentClassName) {
+                                       if (isset($extbaseSettings['classes'][$parentClassName]) && !empty($extbaseSettings['classes'][$parentClassName]['mapping']['tableName'])) {
+                                               $tableName = $extbaseSettings['classes'][$parentClassName]['mapping']['tableName'];
+                                               $mapping = $extbaseSettings['classes'][$parentClassName]['mapping']['columns'];
+                                               break;
+                                       }
+                                       // TODO throw Exception
+                               }
+                       }
+                       
+                       $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap($className, $tableName, $mapping);
                        $this->dataMaps[$className] = $dataMap;
                }
                return $this->dataMaps[$className];
index 761a2a1..87d8f8c 100644 (file)
@@ -59,7 +59,7 @@
  * @version $Id: QueryObjectModel.php 1877 2009-02-05 11:29:07Z k-fish $
  * @scope prototype
  */
-class Tx_Extbase_Persistence_QOM_QueryObjectModel extends Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QOM_QueryObjectModelInterface {
+class Tx_Extbase_Persistence_QOM_QueryObjectModel implements Tx_Extbase_Persistence_QOM_QueryObjectModelInterface {
 
        /**
         * @var Tx_Extbase_Persistence_DataMapper
@@ -92,7 +92,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModel extends Tx_Extbase_Persistence
        protected $storageBackend;
 
        /**
-        * integer
+        * var integer
         */
        protected $limit;
 
@@ -152,6 +152,50 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModel extends Tx_Extbase_Persistence
        public function injectDataMapper(Tx_Extbase_Persistence_Mapper_DataMapper $dataMapper) {
                $this->dataMapper = $dataMapper;
        }
+       
+       /**
+        * Sets the maximum size of the result set to limit.
+        *
+        * @param integer $limit
+        * @return void
+        */
+       public function setLimit($limit) {
+               if ($limit < 1 || !is_int($limit)) {
+                       throw new InvalidArgumentException('setLimit() accepts only integers greater than 0.', 1217244746);
+               }
+               $this->limit = $limit;
+       }
+
+       /**
+        * Returns the maximum size of the result set.
+        *
+        * @return integer
+        */
+       public function getLimit() {
+               return $this->limit;
+       }
+
+       /**
+        * Sets the start offset of the result set to offset.
+        *
+        * @param integer $offset
+        * @return void
+        */
+       public function setOffset($offset) {
+               if ($offset < 0 || !is_int($offset)) {
+                       throw new InvalidArgumentException('setOffset() accepts only integers greater than or equal to 0.', 1217245454);
+               }
+               $this->offset = $offset;
+       }
+
+       /**
+        * Returns the start offset of the result set.
+        *
+        * @return integer
+        */
+       public function getOffset() {
+               return $this->offset;
+       }
 
        /**
         * Returns the class name the query handles
@@ -159,7 +203,7 @@ class Tx_Extbase_Persistence_QOM_QueryObjectModel extends Tx_Extbase_Persistence
         * @return string The class name
         */
        public function getSelectorName() {
-               $this->dataMapper->convertClassNameToSelectorName($this->className);
+               $this->source->getSelectorName();
        }
 
        /**
index 0df0f5d..7fcb23e 100644 (file)
@@ -33,7 +33,7 @@
  * @version $Id: Query.php 658 2009-05-16 13:54:16Z jocrau $
  * @scope prototype
  */
-class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterface {
+class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterface, Tx_Extbase_Persistence_QuerySettingsInterface {
 
        /**
         * @var string
@@ -110,6 +110,7 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         */
        public function __construct($className) {
                $this->className = $className;
+               $this->backendSpecificQuerySettings = t3lib_div::makeInstance('Tx_Extbase_Persistence_Storage_Typo3DbSpecificQuerySettings');
        }
 
        /**
@@ -153,30 +154,28 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
        }
 
        /**
-        * Returns the source to fetch the result from. If the source is not set, it will be generated from the given class name
-        *
-        * @return Tx_Extbase_Persistence_QOM_SourceInterface The source
-        */
-       protected function getSource() {
-               if ($this->source === NULL) {
-                       $this->source = $this->QOMFactory->selector($this->dataMapper->convertClassNameToSelectorName($this->className));
-               }
-               return $this->source;
-       }
-
-       /**
         * Executes the query against the database and returns the result
         *
         * @return Tx_Extbase_Persistence_QueryResultInterface The query result
         */
        public function execute() {
+               if ($this->source === NULL) {
+                       $this->source = $this->QOMFactory->selector($this->dataMapper->convertClassNameToSelectorName($this->className));
+               }
                $query = $this->QOMFactory->createQuery(
-                       $this->getSource(),
+                       $this->source,
                        $this->constraint,
                        $this->orderings,
                        $this->columns, // TODO implement selection of columns
                        $this->backendSpecificQuerySettings
                );
+               if ($this->limit !== NULL) {
+                       $query->setLimit($this->limit);
+               }
+               if ($this->offset !== NULL) {
+                       $query->setOffset($this->offset);       
+               }
+               
                foreach ($this->operands as $name => $value) {
                        $query->bindValue($name, $this->valueFactory->createValue($value));
                }
@@ -229,7 +228,7 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QueryInterface
         */
        public function setOffset($offset) {
-               if (!is_int($offset) || $offset < 0) throw new InvalidArgumentException('The limit must be a positive integer', 1245071872);
+               if (!is_int($offset) || $offset < 0) throw new InvalidArgumentException('The offset must be a positive integer', 1245071872);
                $this->offset = $offset;
                return $this;
        }
@@ -291,7 +290,10 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QOM_ComparisonInterface
         */
        public function withUid($uid) {
-               $sourceSelectorName = $this->getSource()->getSelectorName();
+               if ($this->source === NULL) {
+                       $this->source = $this->QOMFactory->selector($this->dataMapper->convertClassNameToSelectorName($this->className));
+               }
+               $sourceSelectorName = $this->source->getSelectorName();
                $uniqueVariableName = $this->getUniqueVariableName('uid');
                $this->operands[$uniqueVariableName] = $uid;
                return $this->QOMFactory->comparison(
@@ -310,9 +312,8 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QOM_ComparisonInterface
         */
        public function equals($propertyName, $operand, $caseSensitive = TRUE) {
-               $source = $this->getSource();
                $uniqueVariableName = uniqid($propertyName);
-               if ($source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
+               if ($this->source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
                        $sourceSelectorName = $this->getSource()->getSelectorName();
                }
                // TODO $sourceSelectorName might not be initialized
@@ -375,9 +376,8 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QOM_ComparisonInterface
         */
        public function like($propertyName, $operand) {
-               $source = $this->getSource();
                $uniqueVariableName = uniqid($propertyName);
-               if ($source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
+               if ($this->source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
                        $sourceSelectorName = $this->getSource()->getSelectorName();
                }
                // TODO $sourceSelectorName might not be initialized
@@ -398,7 +398,7 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QOM_ComparisonInterface
         */
        public function lessThan($propertyName, $operand) {
-               $sourceSelectorName = $this->getSource()->getSelectorName();
+               $sourceSelectorName = $this->source->getSelectorName();
                $uniqueVariableName = uniqid($propertyName);
                $this->operands[$uniqueVariableName] = $operand;
                return $this->QOMFactory->comparison(
@@ -416,7 +416,7 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QOM_ComparisonInterface
         */
        public function lessThanOrEqual($propertyName, $operand) {
-               $sourceSelectorName = $this->getSource()->getSelectorName();
+               $sourceSelectorName = $this->source->getSelectorName();
                $uniqueVariableName = uniqid($propertyName);
                $this->operands[$uniqueVariableName] = $operand;
                return $this->QOMFactory->comparison(
@@ -434,7 +434,7 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QOM_ComparisonInterface
         */
        public function greaterThan($propertyName, $operand) {
-               $sourceSelectorName = $this->getSource()->getSelectorName();
+               $sourceSelectorName = $this->source->getSelectorName();
                $uniqueVariableName = uniqid($propertyName);
                $this->operands[$uniqueVariableName] = $operand;
                return $this->QOMFactory->comparison(
@@ -452,7 +452,7 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
         * @return Tx_Extbase_Persistence_QOM_ComparisonInterface
         */
        public function greaterThanOrEqual($propertyName, $operand) {
-               $sourceSelectorName = $this->getSource()->getSelectorName();
+               $sourceSelectorName = $this->source->getSelectorName();
                $uniqueVariableName = uniqid($propertyName);
                $this->operands[$uniqueVariableName] = $operand;
                return $this->QOMFactory->comparison(
@@ -465,6 +465,26 @@ class Tx_Extbase_Persistence_Query implements Tx_Extbase_Persistence_QueryInterf
        protected function getUniqueVariableName($propertyName) {
                return uniqid($propertyName);
        }
+       
+       /**
+        * (non-PHPdoc)
+        * @see Classes/Persistence/Tx_Extbase_Persistence_Typo3QueryInterface#useStoragePage($useStoragePage)
+        */
+       // TODO move this method to the settings
+       public function useStoragePage($useStoragePage) {
+               $this->backendSpecificQuerySettings->useStoragePage($useStoragePage);
+               return this;
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see Classes/Persistence/Tx_Extbase_Persistence_Typo3QueryInterface#useEnableFields($useEnableFields)
+        */
+       // TODO move this method to the settings
+       public function useEnableFields($useEnableFields) {
+               $this->backendSpecificQuerySettings->useEnableFields($useEnableFields);
+               return this;
+       }
 
 }
 ?>
index 1b27bf4..0acc35b 100644 (file)
 class Tx_Extbase_Persistence_QueryFactory implements Tx_Extbase_Persistence_QueryFactoryInterface, t3lib_Singleton {
 
        /**
-        * Storage page ID to be used to fetch records
-        * @var integer
-        */
-       protected $storagePageId;
-       
-       /**
-        * Set storage page ID. This method is called in the dispatcher.
-        *
-        * @param integer $storagePageId Storage page ID to use
-        * @return void
-        * @internal
-        */
-       public function setStoragePageId($storagePageId) {
-               $this->storagePageId = (int)$storagePageId;
-       }
-       
-       /**
         * Creates a query object working on the given class name
         *
         * @param string $className The class name
@@ -62,10 +45,9 @@ class Tx_Extbase_Persistence_QueryFactory implements Tx_Extbase_Persistence_Quer
                $dataMapper->injectIdentityMap($persistenceManager->getBackend()->getIdentityMap());
                $dataMapper->injectPersistenceManager($persistenceManager);
 
-               $query = t3lib_div::makeInstance('Tx_Extbase_Persistence_Typo3Query', $className);
+               $query = t3lib_div::makeInstance('Tx_Extbase_Persistence_Query', $className);
                $query->injectPersistenceManager($persistenceManager);
                $query->injectDataMapper($dataMapper);
-               $query->setStoragePageId($this->storagePageId);
                return $query;
        }
 }
index 7485213..1c34a4e 100644 (file)
 /**
  * A QueryResult object. Returned by Query->execute().
  *
- * @package TYPO3CR
- * @subpackage Query
+ * @package Extbase
+ * @subpackage Persistence
  * @version $Id: QueryResult.php 2069 2009-03-26 11:59:53Z k-fish $
  * @scope prototype
  */
 class Tx_Extbase_Persistence_QueryResult implements Tx_Extbase_Persistence_QueryResultInterface {
 
        /**
-        * @var array The tuples of the query result
+        * @var array The rows of the query result
         */
-       protected $tuples;
+       protected $rows;
 
        /**
         * Constructs this QueryResult
         *
-        * @param array $identifiers
+        * @param array $rows The
         */
-       public function __construct(array $tuples) {
-               $this->tuples = $tuples;
+       public function __construct(array $rows) {
+               $this->rows = $rows;
        }
 
        /**
@@ -55,8 +55,8 @@ class Tx_Extbase_Persistence_QueryResult implements Tx_Extbase_Persistence_Query
         * @return array array holding the column names.
         */
        public function getColumnNames() {
-               if (!is_null($this->tuples)) {
-                       return array_keys($this->tuples[0]);
+               if (!is_null($this->rows)) {
+                       return array_keys($this->rows[0]);
                } else {
                        return array();
                }
@@ -70,13 +70,13 @@ class Tx_Extbase_Persistence_QueryResult implements Tx_Extbase_Persistence_Query
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if this call is the second time either getRows() or getNodes() has been called on the same QueryResult object or if another error occurs.
        */
        public function getRows() {
-               if ($this->tuples === NULL) throw new Tx_Extbase_Persistence_Exception_RepositoryException('Illegal getRows() call - can be called only once and not after getNodes().', 1237991809);
+               if ($this->rows === NULL) throw new Tx_Extbase_Persistence_Exception_RepositoryException('Illegal getRows() call - can be called only once and not after getNodes().', 1237991809);
 
                $rowIterator = t3lib_div::makeInstance('Tx_Extbase_Persistence_RowIterator');
-               foreach ($this->tuples as $tuple) {
-                       $rowIterator->append(t3lib_div::makeInstance('Tx_Extbase_Persistence_Row', $tuple));
+               foreach ($this->rows as $row) {
+                       $rowIterator->append(t3lib_div::makeInstance('Tx_Extbase_Persistence_Row', $row));
                }
-               $this->tuples = NULL;
+               $this->rows = NULL;
 
                return $rowIterator;
        }
diff --git a/typo3/sysext/extbase/Classes/Persistence/QuerySettingsInterface.php b/typo3/sysext/extbase/Classes/Persistence/QuerySettingsInterface.php
new file mode 100644 (file)
index 0000000..5b61610
--- /dev/null
@@ -0,0 +1,54 @@
+<?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 query settings interface. This interface is NOT part of the FLOW3 API.
+ * It reflects the settings unique to TYPO3 4.x.
+ *
+ * @package TYPO3
+ * @subpackage Extbase
+ * @version $Id: QueryInterface.php 658 2009-05-16 13:54:16Z jocrau $
+ */
+interface Tx_Extbase_Persistence_QuerySettingsInterface {
+
+       /**
+        * Use storage page
+        * 
+        * @param $useStoragePage if TRUE, should use storage PID. use FALSE to disable the storage Page ID checking 
+        * @return void
+        */
+       public function useStoragePage($useStoragePage);
+       
+       /**
+        * Use enable fields
+        * 
+        * @param $useEnableFields if TRUE, will add enable fields. use FALSE to disable the enable fields checking
+        * @return void
+        */
+       public function useEnableFields($useEnableFields);
+}
+?>
\ No newline at end of file
index 7fb6239..0a0db25 100644 (file)
@@ -137,7 +137,7 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
         */
        public function createQuery($useStoragePageId = TRUE) {
                $repositoryClassName = $this->getRepositoryClassName();
-               if (substr($repositoryClassName, -10) == 'Repository' && substr($repositoryClassName, -11, 1) != '_') {
+               if (substr($repositoryClassName, -10) === 'Repository' && substr($repositoryClassName, -11, 1) !== '_') {
                        $type = substr($repositoryClassName, 0, -10);
                } else {
                        throw new Tx_Extbase_Exception('The domain repository wasn\'t able to resolve the target class name.', 1237897039);
index ff40dff..8867f3e 100644 (file)
@@ -172,6 +172,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                $sql['where'] = array();
                $sql['enableFields'] = array();
                $sql['orderings'] = array();
+               $sql['limit'] = array();
                $parameters = array();
                $tuples = array();
 
@@ -194,13 +195,17 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        $sqlString .= ' ORDER BY ' . implode(', ', $sql['orderings']);
                }
 
+               $this->parseLimitAndOffset($query->getLimit(), $query->getOffset(), $sql, $parameters, $query->getBoundVariableValues());
+               if (!empty($sql['limit'])) {
+                       $sqlString .= ' LIMIT ' . $sql['limit'];
+               }
+
                $this->replacePlaceholders($sqlString, $parameters);
 
                $result = $this->databaseHandle->sql_query($sqlString);
                $this->checkSqlErrors();
                if ($result) {
-                       // TODO Check for selector name
-                       $tuples = $this->getRowsFromResult($query->getSelectorName(), $result);
+                       $tuples = $this->getRowsFromResult($query->getSource(), $result);
                }
                
                return $tuples;
@@ -223,7 +228,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        }
                }
 
-               $sqlString = 'SELECT * FROM ' . $dataMap->getTableName() .  ' WHERE ' . implode('', $fields);
+               $sqlString = 'SELECT * FROM ' . $dataMap->getTableName() .  ' WHERE ' . implode(' AND ', $fields);
                $this->replacePlaceholders($sqlString, $parameters);
                $res = $this->databaseHandle->sql_query($sqlString);
                $this->checkSqlErrors();
@@ -249,11 +254,12 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                        $selectorName = $source->getSelectorName();
                        $sql['fields'][] = $selectorName . '.*';
                        $sql['tables'][] = $selectorName;
+                       $extbaseSettings = Tx_Extbase_Dispatcher::getSettings();
                        if ($query->getBackendSpecificQuerySettings()->enableFieldsEnabled()) {
                                $this->addEnableFieldsStatement($selectorName, $sql);
                        }
                        if ($query->getBackendSpecificQuerySettings()->storagePageEnabled()) {
-                               $sql['enableFields'][] = $selectorName . '.pid=' . intval($query->getBackendSpecificQuerySettings()->getStoragePageId());
+                               $sql['enableFields'][] = $selectorName . '.pid=' . intval($extbaseSettings['storagePid']);
                        }
                } elseif ($source instanceof Tx_Extbase_Persistence_QOM_JoinInterface) {
                        $this->parseJoin($source, $sql, $parameters);
@@ -431,20 +437,21 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
         */
        protected function replacePlaceholders(&$sqlString, array $parameters) {
                if (substr_count($sqlString, '?') !== count($parameters)) throw new Tx_Extbase_Persistence_Exception('The number of question marks to replace must be equal to the number of parameters.', 1242816074);
+               $offset = 0;
                foreach ($parameters as $parameter) {
-                       $markPosition = strpos($sqlString, '?');
+                       $markPosition = strpos($sqlString, '?', $offset);
                        if ($markPosition !== FALSE) {
-                               // TODO This is a bit hacky; improve the handling of $parameter === NULL
                                if ($parameter === NULL) {
                                        $parameter = 'NULL';
                                } else {
-                                       $parameter = '"' . $parameter . '"';
+                                       $parameter = "'" . $parameter . "'"; // TODO Discuss: Do we need quotation?
                                }
                                $sqlString = substr($sqlString, 0, $markPosition) . $parameter . substr($sqlString, $markPosition + 1);
                        }
+                       $offset = $markPosition + strlen($parameter);
                }
        }
-
+       
        /**
         * Builds the enable fields statement
         *
@@ -493,15 +500,35 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
        }
 
        /**
+        * Transforms limit and offset into SQL
+        *
+        * @param int $limit
+        * @param int $offset
+        * @param array &$sql
+        * @return void
+        */
+       protected function parseLimitAndOffset($limit, $offset, array &$sql) {
+               if ($limit !== NULL && $offset !== NULL) {
+                       $sql['limit'] = $offset . ', ' . $limit;
+               } elseif ($limit !== NULL) {
+                       $sql['limit'] = $limit;
+               }
+       }
+
+       /**
         * Transforms a Resource from a database query to an array of rows. Performs the language and
         * workspace overlay before.
+        * 
+        * @param Tx_Extbase_Persistence_QOM_SourceInterface $source The source (selector od join)
         *
         * @return array The result as an array of rows (tuples)
         */
-       protected function getRowsFromResult($tableName, $res) {
+       protected function getRowsFromResult(Tx_Extbase_Persistence_QOM_SourceInterface $source, $res) {
                $rows = array();
                while ($row = $this->databaseHandle->sql_fetch_assoc($res)) {
-                       $row = $this->doLanguageAndWorkspaceOverlay($tableName, $row);
+                       if      ($source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
+                       $row = $this->doLanguageAndWorkspaceOverlay($source->getSelectorName(), $row);
+                       }
                        if (is_array($row)) {
                                // TODO Check if this is necessary, maybe the last line is enough
                                $arrayKeys = range(0,count($row));
index a1fb97d..0898abf 100644 (file)
@@ -68,7 +68,6 @@ class Tx_Extbase_Persistence_Value implements Tx_Extbase_Persistence_ValueInterf
                switch ($this->type) {
                        case Tx_Extbase_Persistence_PropertyType::DATE:
                                if (is_a($this->value, 'DateTime')) {
-                                       // FIXME Handling of DateTime Object
                                        return $this->value->format('U');
                                } else {
                                        $this->value = new DateTime($this->value);
index b584859..13875f7 100755 (executable)
@@ -54,7 +54,7 @@ class Tx_Extbase_Validation_Validator_StringLengthValidator extends Tx_Extbase_V
 
                if (is_object($value) && !method_exists($value, '__toString')) throw new Tx_Extbase_Validation_Exception_InvalidSubject('The given object could not be converted to a string.', 1238110957);
 
-               // TODO Use t3lib_cs::strlen() instead
+               // TODO Use t3lib_cs::strlen() instead; How do we get the charset?
                $stringLength = strlen($value);
                $isValid = TRUE;
                if (isset($this->options['minimum']) && $stringLength < $this->options['minimum']) $isValid = FALSE;
index bd1f9a4..4a0498e 100644 (file)
@@ -1,4 +1,7 @@
 <?php
 if (!defined ('TYPO3_MODE')) die ('Access denied.');
 
+// TODO This is only a preliminary solution
+t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/Settings', 'Setup');
+
 ?>
\ No newline at end of file