EXTMVC:
authorJochen Rau <j.rau@web.de>
Tue, 24 Mar 2009 10:04:23 +0000 (10:04 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 24 Mar 2009 10:04:23 +0000 (10:04 +0000)
* Request is now a prototype
* Renamed "cleanProperties" to "_cleanProperties"
* Removed $blacklistedFindByProperties
* Renamed $session to $persistenceSession
* Now using TSFE instead of cObj for enableFields()
* Removed findOne() from the Persistence Repository
* Added option to switch of enableFields (used by default)

typo3/sysext/extbase/Classes/DomainObject/TX_EXTMVC_DomainObject_AbstractDomainObject.php
typo3/sysext/extbase/Classes/Persistence/Mapper/TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_Exception.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_Repository.php
typo3/sysext/extbase/Classes/Persistence/TX_EXTMVC_Persistence_Session.php
typo3/sysext/extbase/Documentation/todo.txt
typo3/sysext/extbase/Tests/TX_EXTMVC_Persistence_Mapper_DataMap_testcase.php
typo3/sysext/extbase/Tests/TX_EXTMVC_Persistence_Session_testcase.php
typo3/sysext/extbase/class.tx_extmvc_dispatcher.php

index 924e848..659f268 100644 (file)
@@ -42,7 +42,7 @@ abstract class TX_EXTMVC_DomainObject_AbstractDomainObject {
         *
         * @var array
         */
-       private $cleanProperties = NULL;
+       private $_cleanProperties = NULL;
 
        public function __construct() {
                $this->initializeObject();
@@ -107,10 +107,10 @@ abstract class TX_EXTMVC_DomainObject_AbstractDomainObject {
        public function _memorizeCleanState() {
                $this->initializeCleanProperties();
                $cleanProperties = array();
-               foreach ($this->cleanProperties as $propertyName => $propertyValue) {
+               foreach ($this->_cleanProperties as $propertyName => $propertyValue) {
                        $cleanProperties[$propertyName] = $this->$propertyName;
                }
-               $this->cleanProperties = $cleanProperties;
+               $this->_cleanProperties = $cleanProperties;
        }
 
        /**
@@ -120,9 +120,9 @@ abstract class TX_EXTMVC_DomainObject_AbstractDomainObject {
         * @internal
         */
        public function _isDirty() {
-               if (!is_array($this->cleanProperties)) throw new TX_EXTMVC_Persistence_Exception_CleanStateNotMemorized('The clean state of the object "' . get_class($this) . '" has not been memorized before asking _isDirty().', 1233309106);
-               if ($this->uid !== NULL && $this->uid != $this->cleanProperties['uid']) throw new TX_EXTMVC_Persistence_Exception_TooDirty('The uid "' . $this->uid . '" has been modified, that is simply too much.', 1222871239);
-               foreach ($this->cleanProperties as $propertyName => $propertyValue) {
+               if (!is_array($this->_cleanProperties)) throw new TX_EXTMVC_Persistence_Exception_CleanStateNotMemorized('The clean state of the object "' . get_class($this) . '" has not been memorized before asking _isDirty().', 1233309106);
+               if ($this->uid !== NULL && $this->uid != $this->_cleanProperties['uid']) throw new TX_EXTMVC_Persistence_Exception_TooDirty('The uid "' . $this->uid . '" has been modified, that is simply too much.', 1222871239);
+               foreach ($this->_cleanProperties as $propertyName => $propertyValue) {
                        if ($this->$propertyName !== $propertyValue) return TRUE;
                }
                return FALSE;
@@ -145,10 +145,10 @@ abstract class TX_EXTMVC_DomainObject_AbstractDomainObject {
         * @internal
         */
        public function _getDirtyProperties() {
-               if (!is_array($this->cleanProperties)) throw new TX_EXTMVC_Persistence_Exception_CleanStateNotMemorized('The clean state of the object "' . get_class($this) . '" has not been memorized before asking _isDirty().', 1233309106);
-               if ($this->uid !== NULL && $this->uid != $this->cleanProperties['uid']) throw new TX_EXTMVC_Persistence_Exception_TooDirty('The uid "' . $this->uid . '" has been modified, that is simply too much.', 1222871239);
+               if (!is_array($this->_cleanProperties)) throw new TX_EXTMVC_Persistence_Exception_CleanStateNotMemorized('The clean state of the object "' . get_class($this) . '" has not been memorized before asking _isDirty().', 1233309106);
+               if ($this->uid !== NULL && $this->uid != $this->_cleanProperties['uid']) throw new TX_EXTMVC_Persistence_Exception_TooDirty('The uid "' . $this->uid . '" has been modified, that is simply too much.', 1222871239);
                $dirtyProperties = array();
-               foreach ($this->cleanProperties as $propertyName => $propertyValue) {
+               foreach ($this->_cleanProperties as $propertyName => $propertyValue) {
                        if ($this->$propertyName !== $propertyValue) {
                                $dirtyProperties[$propertyName] = $this->$propertyName;
                        }
@@ -168,10 +168,10 @@ abstract class TX_EXTMVC_DomainObject_AbstractDomainObject {
                $dataMapper = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper');
                foreach ($properties as $propertyName => $propertyValue) {
                        if ($dataMapper->isPersistableProperty(get_class($this), $propertyName)) {
-                               $this->cleanProperties[$propertyName] = NULL;
+                               $this->_cleanProperties[$propertyName] = NULL;
                        }
                }
-               $this->cleanProperties['uid'] = NULL;
+               $this->_cleanProperties['uid'] = NULL;
        }
 
 }
index ef819a6..1dcd661 100644 (file)
@@ -34,19 +34,12 @@ require_once(PATH_tslib . 'class.tslib_content.php');
  */
 class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singleton {
 
-       /**
-        * The content object
-        *
-        * @var tslib_cObj
-        **/
-       protected $cObj;
-
        /**
         * The persistence session
         *
         * @var TX_EXTMVC_Persistence_Session
         **/
-       protected $session;
+       protected $persistenceSession;
 
        /**
         * Cached data maps
@@ -60,50 +53,61 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
         *
         */
        public function __construct() {
-               $this->cObj = t3lib_div::makeInstance('tslib_cObj');
-               $this->session = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session');
+               $this->persistenceSession = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session');
                $GLOBALS['TSFE']->includeTCA();
        }
 
-       /**
-        * Finds objects matching a given WHERE Clause
-        *
-        * @param string $where WHERE statement
-        * @param string $groupBy GROUP BY statement
-        * @param string $orderBy ORDER BY statement
-        * @param string $limit LIMIT statement
-        * @return array An array of reconstituted domain objects
-        */
-       public function findWhere($className, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '') {
-               // TODO check PID for records
-               $dataMap = $this->getDataMap($className);
-               $rows = $this->fetch($dataMap, $where, $groupBy, $orderBy, $limit);
-               $objects = $this->reconstituteObjects($dataMap, $rows);
-               return $objects;
-       }
+       // /**
+       //  * Finds objects matching a given WHERE Clause
+       //  *
+       //  * @param string $where WHERE statement
+       //  * @param string $groupBy GROUP BY statement
+       //  * @param string $orderBy ORDER BY statement
+       //  * @param string $limit LIMIT statement
+       //  * @return array An array of reconstituted domain objects
+       //  */
+       // public function findWhere($className, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '') {
+       //      // TODO check PID for records
+       //      $dataMap = $this->getDataMap($className);
+       //      $rows = $this->fetch($dataMap, $where, $groupBy, $orderBy, $limit);
+       //      $objects = $this->reconstituteObjects($dataMap, $rows);
+       //      return $objects;
+       // }
 
        /**
         * Fetches rows from the database by given SQL statement snippets
         *
-        * @param TX_EXTMVC_Persistence_Mapper_DataMap $dataMap The Data Map holding the configuration of the table and the Column Maps
+        * @param string $className the className
         * @param string $where WHERE statement
         * @param string $groupBy GROUP BY statement
         * @param string $orderBy ORDER BY statement
         * @param string $limit LIMIT statement
         * @return array The matched rows
         */
-       public function fetch($dataMap, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '') {
+       public function fetch($className, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {
+               $dataMap = $this->getDataMap($className);
+               if ($useEnableFields === TRUE) {
+                       $enableFields = $GLOBALS['TSFE']->sys_page->enableFields($dataMap->getTableName());
+               } else {
+                       $enableFields = '';
+               }
                $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                        '*', // TODO limit fetched fields
                        $dataMap->getTableName(),
-                       $where . $this->cObj->enableFields($dataMap->getTableName()),
+                       $where . $enableFields,
                        $groupBy,
                        $orderBy,
                        $limit
                        );
                // SK: Do we want to make it possible to ignore "enableFields"?
                // TODO language overlay; workspace overlay
-               return $rows ? $rows : array();
+               $objects = array();
+               if (is_array($rows)) {
+                       if (count($rows) > 0) {
+                               $objects = $this->reconstituteObjects($dataMap, $rows);
+                       }
+               }
+               return $objects;
        }
 
        /**
@@ -115,11 +119,16 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
         * @param string Optional LIMIT value ([begin,]max), defaults to blank string.
         */
        // SK: Are SQL injections possible here? Can we somehow prevent them? I did not check it thoroughly yet, but I think they are possible
-       public function fetchWithRelationTable($parentObject, $columnMap, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '') {
+       public function fetchWithRelationTable($parentObject, $columnMap, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {
+               if ($useEnableFields === TRUE) {
+                       $enableFields = $GLOBALS['TSFE']->sys_page->enableFields($columnMap->getChildTableName());
+               } else {
+                       $enableFields = '';
+               }
                $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                        $columnMap->getChildTableName() . '.*, ' . $columnMap->getRelationTableName() . '.*',
                        $columnMap->getChildTableName() . ' LEFT JOIN ' . $columnMap->getRelationTableName() . ' ON (' . $columnMap->getChildTableName() . '.uid=' . $columnMap->getRelationTableName() . '.uid_foreign)',
-                       $where . ' AND ' . $columnMap->getRelationTableName() . '.uid_local=' . t3lib_div::intval_positive($parentObject->getUid()) . $this->cObj->enableFields($columnMap->getChildTableName()),
+                       $where . ' AND ' . $columnMap->getRelationTableName() . '.uid_local=' . t3lib_div::intval_positive($parentObject->getUid()) . $enableFields,
                        $groupBy,
                        $orderBy,
                        $limit
@@ -139,7 +148,7 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
        // SK: Are loops detected during reconstitution?
        // SK: What about "1:1" relations?
        protected function reconstituteObjects($dataMap, array $rows) {
-               $objects = array();
+               $objects = array();             
                foreach ($rows as $row) {
                        $properties = array();
                        foreach ($dataMap->getColumnMaps() as $columnMap) {
@@ -150,17 +159,15 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
                                if ($columnMap->getTypeOfRelation() === TX_EXTMVC_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
                                        $where = $columnMap->getParentKeyFieldName() . '=' . intval($object->getUid());
                                        $relatedDataMap = $this->getDataMap($columnMap->getChildClassName());
-                                       $relatedRows = $this->fetch($relatedDataMap, $where);
-                                       $relatedObjects = $this->reconstituteObjects($relatedDataMap, $relatedRows, $depth);
+                                       $relatedObjects = $this->fetch($columnMap->getChildClassName(), $where);
                                        $object->_reconstituteProperty($columnMap->getPropertyName(), $relatedObjects);
                                } elseif ($columnMap->getTypeOfRelation() === TX_EXTMVC_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
                                        $relatedDataMap = $this->getDataMap($columnMap->getChildClassName());
-                                       $relatedRows = $this->fetchWithRelationTable($object, $columnMap);
-                                       $relatedObjects = $this->reconstituteObjects($relatedDataMap, $relatedRows, $depth);
+                                       $relatedObjects = $this->fetchWithRelationTable($object, $columnMap);
                                        $object->_reconstituteProperty($columnMap->getPropertyName(), $relatedObjects);
                                }
                        }
-                       $this->session->registerReconstitutedObject($object);
+                       $this->persistenceSession->registerReconstitutedObject($object);
                        $objects[] = $object;
                }
                return $objects;
@@ -188,7 +195,7 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
         */
        public function persistAll() {
                // first, persit all aggregate root objects
-               $aggregateRootClassNames = $this->session->getAggregateRootClassNames();
+               $aggregateRootClassNames = $this->persistenceSession->getAggregateRootClassNames();
                foreach ($aggregateRootClassNames as $className) {
                        $this->persistObjects($className);
                }
@@ -197,25 +204,25 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
        }
 
        /**
-        * Persists all objects of a persitance session that are of a given class. If there
-        * is no class specified, it persits all objects of a session.
+        * Persists all objects of a persitance persistence session that are of a given class. If there
+        * is no class specified, it persits all objects of a persistence session.
         *
         * @param string $className Name of the class of the objects to be persisted
         */
        protected function persistObjects($className = NULL) {
-               foreach ($this->session->getAddedObjects($className) as $object) {
+               foreach ($this->persistenceSession->getAddedObjects($className) as $object) {
                        $this->insertObject($object);
-                       $this->session->unregisterObject($object);
-                       $this->session->registerReconstitutedObject($object);
+                       $this->persistenceSession->unregisterObject($object);
+                       $this->persistenceSession->registerReconstitutedObject($object);
                }
-               foreach ($this->session->getDirtyObjects($className) as $object) {
+               foreach ($this->persistenceSession->getDirtyObjects($className) as $object) {
                        $this->updateObject($object);
-                       $this->session->unregisterObject($object);
-                       $this->session->registerReconstitutedObject($object);
+                       $this->persistenceSession->unregisterObject($object);
+                       $this->persistenceSession->registerReconstitutedObject($object);
                }
-               foreach ($this->session->getRemovedObjects($className) as $object) {
+               foreach ($this->persistenceSession->getRemovedObjects($className) as $object) {
                        $this->deleteObject($object);
-                       $this->session->unregisterObject($object);
+                       $this->persistenceSession->unregisterObject($object);
                }
        }
 
@@ -394,12 +401,12 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
                        if (!empty($relatedObjects)) {
                                $typeOfRelation = $dataMap->getColumnMap($propertyName)->getTypeOfRelation();
                                foreach ($relatedObjects as $relatedObject) {
-                                       if (!$this->session->isReconstitutedObject($relatedObject)) {
+                                       if (!$this->persistenceSession->isReconstitutedObject($relatedObject)) {
                                                $this->insertObject($relatedObject, $object, $propertyName);
                                                if ($typeOfRelation === TX_EXTMVC_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
                                                        $this->insertRelationInRelationTable($relatedObject, $object, $propertyName);
                                                }
-                                       } elseif ($this->session->isReconstitutedObject($relatedObject) && $relatedObject->_isDirty()) {
+                                       } elseif ($this->persistenceSession->isReconstitutedObject($relatedObject) && $relatedObject->_isDirty()) {
                                                $this->updateObject($relatedObject, $object, $propertyName);
                                        }
                                }
index 03f301f..ad28120 100644 (file)
@@ -29,7 +29,7 @@
  * @subpackage extmvc
  * @version $ID:$
  */
-class Exception extends F3_FLOW3_Exception {
+class TX_EXTMVC_Persistence_Exception extends TX_EXTMVC_Exception {
 }
 
 ?>
\ No newline at end of file
index 47e8eea..c837336 100644 (file)
@@ -53,21 +53,7 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
         *
         * @var TX_EXTMVC_Persistence_Session
         */
-       protected $session;
-
-       /**
-        * Holds an array of blacklisted properties not to be called via magic findBy methods
-        *
-        * @var array
-        */
-       protected $blacklistedFindByProperties = array('passwd', 'password');
-
-       /**
-        * The content object
-        *
-        * @var tslib_cObj
-        **/
-       protected $cObj;
+       protected $persistenceSession;
 
        /**
         * Constructs a new Repository
@@ -75,15 +61,14 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
         */
        public function __construct() {
                $this->objects = new TX_EXTMVC_Persistence_ObjectStorage();
-               $this->cObj = t3lib_div::makeInstance('tslib_cObj');
                $repositoryClassName = get_class($this);
                if (substr($repositoryClassName, -10) == 'Repository' && substr($repositoryClassName, -11, 1) != '_') {
                        $this->aggregateRootClassName = substr($repositoryClassName, 0, -10);
                }
                // TODO not entity or empty aggregateRootClassName -> exception
                $this->dataMapper = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper'); // singleton
-               $this->session = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session'); // singleton
-               $this->session->registerAggregateRootClassName($this->aggregateRootClassName);
+               $this->persistenceSession = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session'); // singleton
+               $this->persistenceSession->registerAggregateRootClassName($this->aggregateRootClassName);
        }
 
        /**
@@ -95,7 +80,7 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
        public function add($object) {
                if (!($object instanceof $this->aggregateRootClassName)) throw new TX_EXTMVC_Persistence_Exception_InvalidClass('The class "' . get_class($object) . '" is not supported by the repository.');
                $this->objects->attach($object);
-               $this->session->registerAddedObject($object);
+               $this->persistenceSession->registerAddedObject($object);
        }
 
        /**
@@ -107,7 +92,7 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
        public function remove($object) {
                if (!($object instanceof $this->aggregateRootClassName)) throw new TX_EXTMVC_Persistence_Exception_InvalidClass('The class "' . get_class($object) . '" is not supported by the repository.');
                $this->objects->detach($object);
-               $this->session->registerRemovedObject($object);
+               $this->persistenceSession->registerRemovedObject($object);
        }
 
        /**
@@ -121,18 +106,14 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
        public function __call($methodName, $arguments) {
                if (substr($methodName, 0, 6) === 'findBy' && strlen($methodName) > 7) {
                        $propertyName = TX_EXTMVC_Utility_Strings::lowercaseFirst(substr($methodName,6));
-                       if (!in_array($propertyName, $this->blacklistedFindByProperties)) {
-                               return $this->findByProperty($propertyName, $arguments[0]);
-                       }
+                       return $this->findByProperty($propertyName, $arguments[0]);
                } elseif (substr($methodName, 0, 9) === 'findOneBy' && strlen($methodName) > 10) {
                        $propertyName = TX_EXTMVC_Utility_Strings::lowercaseFirst(substr($methodName,9));
-                       if (!in_array($propertyName, $this->blacklistedFindByProperties)) {
-                               $result = $this->findByProperty($propertyName, $arguments[0]);
-                               if (empty($result)) {
-                                       return FALSE;
-                               } else {
-                                       return $result[0]; // TODO Implement LIMIT
-                               }
+                       $result = $this->findByProperty($propertyName, $arguments[0]);
+                       if (empty($result)) {
+                               return FALSE;
+                       } else {
+                               return $result[0]; // TODO Implement LIMIT
                        }
                }
                throw new TX_EXTMVC_Persistence_Exception_UnsupportedMethod('The method "' . $methodName . '" is not supported by the repository.', 1233180480);
@@ -147,17 +128,6 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
                return $this->dataMapper->findWhere($this->aggregateRootClassName);
        }
 
-       /**
-        * Returns the first objects found in this repository
-        *
-        * @return TX_EXTMVC_DomainObject_AbstractDomainObject A single object, empty if no objects found
-        */
-       public function findOne() {
-               // TODO implement support for SQL LIMIT
-               $result = $this->dataMapper->findWhere($this->aggregateRootClassName);
-               return $result[0];
-       }
-
        /**
         * Finds objects matching 'property=xyz'
         *
@@ -172,23 +142,19 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
                } else {
                        $where = $propertyName . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value, '');
                }
-               return $this->dataMapper->findWhere($this->aggregateRootClassName, $where);
+               return $this->findWhere($this->aggregateRootClassName, $where);
        }
 
        /**
-        * Delegates findWhere() to the ObjectRelationalMapper
+        * A generic find where method
         *
         * @param string $className The class name
         * @param string $arguments The WHERE statement
         * @return void
         */
-       public function findWhere($className, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '') {
-               // TODO check PID for records? - no
-               // TODO Switch for enableFields; TRUE by default
-               $dataMap = $this->getDataMap($className);
-               $rows = $this->fetch($dataMap, $where, $groupBy, $orderBy, $limit);
-               $objects = $this->reconstituteObjects($dataMap, $rows);
-               return $objects;
+       public function findWhere($className, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {
+               // TODO check for aggregateRootclassName
+               return $this->dataMapper->fetch($className, $where, $groupBy, $orderBy, $limit);
        }
 
 }
index 8721f89..39ee008 100644 (file)
@@ -94,7 +94,7 @@ class TX_EXTMVC_Persistence_Session implements t3lib_singleton {
         * @return void
         */
        // SK: When is this method called?
-       // JR: $this->unregisterObject() to clear the session
+       // JR: $this->unregisterObject() to clear the persistence session
        public function unregisterAddedObject(TX_EXTMVC_DomainObject_AbstractDomainObject $object) {
                $this->addedObjects->detach($object);
        }
index d58f809..48145e2 100644 (file)
@@ -1,4 +1,55 @@
-The SQL statements are issued in the following order
+       • Dispatcher -> "action"-Argument needs to be namespaced. What happens if we have e.g. multiple blogs at one page? -> We need some unique ID
+               • [DONE] Request -> should be prototype
+               • Instead of a type hint for "AbstractController", we should use "ControllerInterface" (Dispatcher.php line 97)
+               • CSRF problems? Ideas?
+                       • "Transaction" with "Transaction ID"
+                       • Postpone this to 4.4
+                       • Idea: making checks in the Actions -> Certain actions should only accept POST (the "updateAction" would only do something if called with HTTP POST)
+               • Extension Key
+               • AdditionalHeaderData -> we need to make sure that f.e. jQuery is only embedded once
+
+       • Make MVC work with the new autoloader of 4.3
+       • RealURL testing
+       • Directory "Classes/Web" -> should be "Classes/Controller/Web"??
+       • Persistence_Session->clear() .... ->removeAll() should be replaced by "new SPLObjectStorage"
+       • Documentation: Document the _stuff (CGL!!)
+       • Naming (CGL!!)
+       • [DONE] AbstractDomainObject -- "cleanProperties" should be renamed to "_cleanProperties"
+       • AbstractDomainObject->uid should go to Entity
+       • [DONE] Persistence_Repository -- remove $blacklistedFindByProperties
+       • [DONE] Persistence_Repository - protected $persistence session -- rename to $persistence session
+       • [DONE] Persistence_Repository -- strip out "enableFields" from "cObj"  to TSFE, and use TSFE instead of cObj
+       • [DONE] Persistence_Repository->findOne() REMOVE
+       • 4.4 -> Query Object support? (Jan-Erik Revsbech)
+       • [DONE] Persistence_Repository->findWhere() -- add enableFields by default (but make it possible to switch it of)
+       • Persistence_Mapper_DataMap -- implement "aliasing" (Use case: Long name -> tx_twitter_something_twitter -> "twitter", so you can say "findByTwitterName" )
+       • Persistence_Mapper_DataMap -- tstamp is not needed, same for cruser_id
+       • Persistence_Mapper_DataMap->setTypeOfValue  -- we need to explode stuff and not use strpos
+       • Persistence_Mapper_DataMap -- check with IRRE (Olly)
+       • 4.4 - throw away all comma separated lists, and replace them with MM tables
+       • Is CreationDate and tstamp updated on updates?
+       • ObjectRelationalMapper->fetch() -- instead of "$where", which is a string, pass on an array. A "printf" string, and all values which get quoted automatically (Andi Förthner)
+       • ObjectRelationalMapper -- first delete relations, then relate the root
+       • ObjectRelationalMapper -- rename "$recursionMode" to "$recurseIntoRelations"
+       • Put Configuration, Validation and Utility into t3lib
+
+       [DONE] method dispatch() too long
+        getInstance()? -> opinion: in general -> no!
+        [DONE] ->buildRequest()
+        [DONE] ->getControllerSettings(xy)
+
+
+ToDo
+Caching -> Talk with Stucki
+Names
+
+
+
+KICKSTARTER -> GSoC
+
+
+
+The SQL statements should be issued in the following order
 
     * all entity insertions, in the same order the corresponding objects were added using $repository->add($object)
     * all entity updates
index a1898f4..86f281e 100644 (file)
@@ -28,7 +28,6 @@ require_once(t3lib_extMgm::extPath('blogexample') . 'Classes/Domain/TX_Blogexamp
 class TX_EXTMVC_Persistence_Mapper_DataMap_testcase extends tx_phpunit_testcase {
        
        public function setUp() {
-               $this->cObj = t3lib_div::makeInstance('tslib_cObj');
                $GLOBALS['TSFE']->fe_user = $this->getMock('tslib_feUserAuth');
                $GLOBALS['TSFE'] = $this->getMock('tslib_fe', array('includeTCA'));
                $this->setupTca();
index 7cfb17b..72ce0de 100644 (file)
@@ -30,22 +30,22 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
        
        public function test_NewSessionIsEmpty() {
-               $session = new TX_EXTMVC_Persistence_Session;
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
                $this->assertEquals(0, count($reconstitutedObjects), 'The reconstituted objects storage was not empty.');
        }
 
        public function test_ObjectCanBeRegisteredAsAdded() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerAddedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerAddedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(1, count($addedObjects), 'The added objects storage holds 0 or more than 1 objects.');
                $this->assertSame($entity, $addedObjects[0], 'The returned object was not the same as the registered one.');
@@ -54,12 +54,12 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_ObjectCanBeRegisteredAsRemoved() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerRemovedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerRemovedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(1, count($removedObjects), 'The removed objects storage holds 0 or more than 1 objects.');
@@ -68,12 +68,12 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_ObjectCanBeRegisteredAsReconstituted() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerReconstitutedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerReconstitutedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
@@ -82,13 +82,13 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_ObjectCanBeUnregisteredAsAdded() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerAddedObject($entity);
-               $session->unregisterAddedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerAddedObject($entity);
+               $persistenceSession->unregisterAddedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
@@ -96,13 +96,13 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_ObjectCanBeUnregisteredAsRemoved() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerRemovedObject($entity);
-               $session->unregisterRemovedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerRemovedObject($entity);
+               $persistenceSession->unregisterRemovedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
@@ -110,26 +110,26 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_ObjectCanBeUnregisteredAsReconstituted() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerReconstitutedObject($entity);
-               $session->unregisterReconstitutedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerReconstitutedObject($entity);
+               $persistenceSession->unregisterReconstitutedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
                $this->assertEquals(0, count($reconstitutedObjects), 'The reconstituted objects storage was not empty.');
        }
        public function test_ObjectCanBeRemovedAfterBeingAdded() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerAddedObject($entity);
-               $session->registerRemovedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerAddedObject($entity);
+               $persistenceSession->registerRemovedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
@@ -137,13 +137,13 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_AnObjectCanBeRemovedAfterBeingAdded() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerAddedObject($entity);
-               $session->registerRemovedObject($entity);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerAddedObject($entity);
+               $persistenceSession->registerRemovedObject($entity);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
                
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
@@ -152,34 +152,34 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
 
        public function test_TryingToRegisterReconstitutedObjectsAsAddedResultsInAnException() {
                $this->setExpectedException('InvalidArgumentException');
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerReconstitutedObject($entity);
-               $session->registerAddedObject($entity);
+               $persistenceSession->registerReconstitutedObject($entity);
+               $persistenceSession->registerAddedObject($entity);
        }
 
        public function test_TryingToRegisterAddedObjectsAsReconstitutedResultsInAnException() {
                $this->setExpectedException('InvalidArgumentException');
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity1 = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerAddedObject($entity1);
-               $session->registerReconstitutedObject($entity1);
+               $persistenceSession->registerAddedObject($entity1);
+               $persistenceSession->registerReconstitutedObject($entity1);
        }
 
        public function test_SessionCanBeCleared() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity1 = $this->getMock('TX_EXTMVC_DomainObject_Entity');
                $entity2 = $this->getMock('TX_EXTMVC_DomainObject_Entity');
                $entity3 = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerAddedObject($entity1);
-               $session->registerRemovedObject($entity2);
-               $session->registerReconstitutedObject($entity3);
-               $session->registerAggregateRootClassName('TX_EXTMVC_DomainObject_Entity');
-               $session->clear();
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
-               $aggregateRootClassNames = $session->getAggregateRootClassNames();
+               $persistenceSession->registerAddedObject($entity1);
+               $persistenceSession->registerRemovedObject($entity2);
+               $persistenceSession->registerReconstitutedObject($entity3);
+               $persistenceSession->registerAggregateRootClassName('TX_EXTMVC_DomainObject_Entity');
+               $persistenceSession->clear();
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
+               $aggregateRootClassNames = $persistenceSession->getAggregateRootClassNames();
 
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
@@ -188,19 +188,19 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_ObjectCanBeUnregistered() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity1 = $this->getMock('TX_EXTMVC_DomainObject_Entity');
                $entity2 = $this->getMock('TX_EXTMVC_DomainObject_Entity');
                $entity3 = $this->getMock('TX_EXTMVC_DomainObject_Entity');
-               $session->registerAddedObject($entity1);
-               $session->registerRemovedObject($entity2);
-               $session->registerReconstitutedObject($entity3);
-               $session->unregisterObject($entity1);
-               $session->unregisterObject($entity2);
-               $session->unregisterObject($entity3);
-               $addedObjects = $session->getAddedObjects();
-               $removedObjects = $session->getRemovedObjects();
-               $reconstitutedObjects = $session->getReconstitutedObjects();
+               $persistenceSession->registerAddedObject($entity1);
+               $persistenceSession->registerRemovedObject($entity2);
+               $persistenceSession->registerReconstitutedObject($entity3);
+               $persistenceSession->unregisterObject($entity1);
+               $persistenceSession->unregisterObject($entity2);
+               $persistenceSession->unregisterObject($entity3);
+               $addedObjects = $persistenceSession->getAddedObjects();
+               $removedObjects = $persistenceSession->getRemovedObjects();
+               $reconstitutedObjects = $persistenceSession->getReconstitutedObjects();
 
                $this->assertEquals(0, count($addedObjects), 'The added objects storage was not empty.');
                $this->assertEquals(0, count($removedObjects), 'The removed objects storage was not empty.');
@@ -208,15 +208,15 @@ class TX_EXTMVC_Persistence_Session_testcase extends tx_phpunit_testcase {
        }
 
        public function test_DirtyEntitiesAreReturned() {
-               $session = new TX_EXTMVC_Persistence_Session;
+               $persistenceSession = new TX_EXTMVC_Persistence_Session;
                $entity = $this->getMock('TX_EXTMVC_DomainObject_Entity');
                $entity->expects($this->any())
                        ->method('_isDirty')
                        ->will($this->returnValue(TRUE));
-               $session->registerReconstitutedObject($entity);
-               $dirtyObjects = $session->getDirtyObjects();
+               $persistenceSession->registerReconstitutedObject($entity);
+               $dirtyObjects = $persistenceSession->getDirtyObjects();
                $this->assertEquals(1, count($dirtyObjects), 'There is more than one dirty object.');
-               $this->assertEquals($entity, $dirtyObjects[0], 'The entity doesn\'t equal to the dirty object retrieved from the session.');
+               $this->assertEquals($entity, $dirtyObjects[0], 'The entity doesn\'t equal to the dirty object retrieved from the persistenceSession.');
        }
 
        
index 4529867..4d392cb 100644 (file)
@@ -111,14 +111,14 @@ class TX_EXTMVC_Dispatcher {
                $response = t3lib_div::makeInstance('TX_EXTMVC_Web_Response');
                $controller->injectSettings($this->getSettings($extensionKey));
 
-               $session = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session');
+               $persistenceSession = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session');
                try {
                        $controller->processRequest($request, $response);
                } catch (TX_EXTMVC_Exception_StopAction $ignoredException) {
                }
-               // debug($session);
-               $session->commit();
-               $session->clear();
+               // debug($persistenceSession);
+               $persistenceSession->commit();
+               $persistenceSession->clear();
                
                if (count($response->getAdditionalHeaderData()) > 0) {
                        $GLOBALS['TSFE']->additionalHeaderData[$request->getControllerExtensionKey()] = implode("\n", $response->getAdditionalHeaderData());