ExtBase:
authorJochen Rau <j.rau@web.de>
Fri, 27 Mar 2009 10:53:46 +0000 (10:53 +0000)
committerJochen Rau <j.rau@web.de>
Fri, 27 Mar 2009 10:53:46 +0000 (10:53 +0000)
* Adapted tests according to the changed folder structure
* ORM refactoring part II (to be continued)

typo3/sysext/extbase/Classes/Persistence/Mapper/ObjectRelationalMapper.php
typo3/sysext/extbase/Classes/Persistence/Tests/Repository_testcase.php
typo3/sysext/extbase/Tests/DataMap_testcase.php
typo3/sysext/extbase/Tests/ObjectRelationalMapper_testcase.php
typo3/sysext/extbase/Tests/Repository_testcase.php
typo3/sysext/extbase/class.tx_extbase_dispatcher.php

index 24896b6..274943a 100644 (file)
@@ -60,7 +60,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
         *
         */
        public function __construct() {
-               $this->persistenceSession = t3lib_div::makeInstance('Tx_ExtBase_Persistence_Session');
+               $this->persistenceSession = t3lib_div::makeInstance('Tx_ExtBase_Persistence_Session'); // singleton
                $GLOBALS['TSFE']->includeTCA();
                $this->database = $GLOBALS['TYPO3_DB'];
        }
@@ -98,7 +98,39 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
 
                $objects = array();
                if (is_array($rows) && (count($rows) > 0)) {
-                       $objects = $this->reconstituteObjects($dataMap, $rows);
+                       $objects = $this->reconstituteObjects($className, $rows);
+               }
+               return $objects;
+       }
+       
+       /**
+        * Fetches a rows from the database by given SQL statement snippets taking a relation table into account
+        *
+        * @param string Optional WHERE clauses put in the end of the query, defaults to '1=1. NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself!
+        * @param string Optional GROUP BY field(s), defaults to blank string.
+        * @param string Optional ORDER BY field(s), defaults to blank string.
+        * @param string Optional LIMIT value ([begin,]max), defaults to blank string.
+        */
+       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 = $this->database->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()) . $enableFields,
+                       $groupBy,
+                       $orderBy,
+                       $limit
+                       );
+               // TODO language overlay; workspace overlay; sorting
+               $objects = array();
+               if (is_array($rows)) {
+                       if (count($rows) > 0) {
+                               $objects = $this->reconstituteObjects($columnMap->getChildClassName(), $rows);
+                       }
                }
                return $objects;
        }
@@ -253,39 +285,6 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
        }
        
        /**
-        * Fetches a rows from the database by given SQL statement snippets taking a relation table into account
-        *
-        * @param string Optional WHERE clauses put in the end of the query, defaults to '1=1. NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself!
-        * @param string Optional GROUP BY field(s), defaults to blank string.
-        * @param string Optional ORDER BY field(s), defaults to blank string.
-        * @param string Optional LIMIT value ([begin,]max), defaults to blank string.
-        */
-       public function fetchWithRelationTable($parentObject, $columnMap, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {
-               $dataMap = $this->getDataMap('Tx_BlogExample_Domain_Tag'); // FIXME hard-coded class name
-               if ($useEnableFields === TRUE) {
-                       $enableFields = $GLOBALS['TSFE']->sys_page->enableFields($columnMap->getChildTableName());
-               } else {
-                       $enableFields = '';
-               }
-               $rows = $this->database->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()) . $enableFields,
-                       $groupBy,
-                       $orderBy,
-                       $limit
-                       );
-               // TODO language overlay; workspace overlay; sorting
-               $objects = array();
-               if (is_array($rows)) {
-                       if (count($rows) > 0) {
-                               $objects = $this->reconstituteObjects($dataMap, $rows);
-                       }
-               }
-               return $objects;
-       }
-
-       /**
         * reconstitutes domain objects from $rows (array)
         *
         * @param Tx_ExtBase_Persistence_Mapper_DataMap $dataMap The data map corresponding to the domain object
@@ -295,7 +294,8 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
         */
        // SK: I Need to check this method more thoroughly.
        // SK: Are loops detected during reconstitution?
-       protected function reconstituteObjects($dataMap, array $rows) {
+       protected function reconstituteObjects($className, array $rows) {
+               $dataMap = $this->getDataMap($className);
                $objects = array();
                foreach ($rows as $row) {
                        $properties = array();
@@ -306,7 +306,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
                        $object = $this->reconstituteObject($dataMap->getClassName(), $properties);
                        foreach ($dataMap->getColumnMaps() as $columnMap) {
                                if ($columnMap->getTypeOfRelation() === Tx_ExtBase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE) {
-                                       list($relatedObject) = $this->reconstituteObjects($this->getDataMap($columnMap->getChildClassName()), array($row));
+                                       list($relatedObject) = $this->reconstituteObjects($columnMap->getChildClassName(), $row);
                                        $object->_reconstituteProperty($columnMap->getPropertyName(), $relatedObject);
                                } elseif ($columnMap->getTypeOfRelation() === Tx_ExtBase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
                                        $where = $columnMap->getParentKeyFieldName() . '=' . intval($object->getUid());
@@ -706,7 +706,6 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
         * @return Tx_ExtBase_Persistence_Mapper_DataMap The data map
         */
        protected function getDataMap($className) {
-               // TODO Cache data maps
                if (empty($this->dataMaps[$className])) {
                        $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap($className);
                        $dataMap->initialize();
index 49e20b3..251890e 100644 (file)
@@ -40,11 +40,11 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
 
        public function test_FindByConditionWithPlaceholders() {
-               $repository = new Tx_BlogExample_Domain_BlogRepository();
+               $repository = new Tx_BlogExample_Domain_Model_BlogRepository();
                $repository->dataMapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
                $repository->dataMapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
                        ->method('fullQuoteStr')
@@ -68,11 +68,11 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
 
        public function test_FindByConditionWithExample() {
-               $repository = new Tx_BlogExample_Domain_BlogRepository();
+               $repository = new Tx_BlogExample_Domain_Model_BlogRepository();
                $repository->dataMapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
                $repository->dataMapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
                        ->method('fullQuoteStr')
@@ -91,7 +91,7 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
        
        public function test_MagicFindByPropertyUsesGenericFind() {
-               $repository = $this->getMock('Tx_BlogExample_Domain_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Blog'));
+               $repository = $this->getMock('Tx_BlogExample_Domain_Model_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Model_Blog'));
                $repository->expects($this->once())
                        ->method('find')
                        ->with($this->equalTo(array('name' => 'foo')))
@@ -143,11 +143,11 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
 
        public function test_FindByConditionWithPlaceholders() {
-               $repository = new Tx_BlogExample_Domain_BlogRepository();
+               $repository = new Tx_BlogExample_Domain_Model_BlogRepository();
                $repository->dataMapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
                $repository->dataMapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
                        ->method('fullQuoteStr')
@@ -171,11 +171,11 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
 
        public function test_FindByConditionWithExample() {
-               $repository = new Tx_BlogExample_Domain_BlogRepository();
+               $repository = new Tx_BlogExample_Domain_Model_BlogRepository();
                $repository->dataMapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
                $repository->dataMapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
                        ->method('fullQuoteStr')
@@ -194,7 +194,7 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
        
        public function test_MagicFindByPropertyUsesGenericFind() {
-               $repository = $this->getMock('Tx_BlogExample_Domain_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Blog'));
+               $repository = $this->getMock('Tx_BlogExample_Domain_Model_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Model_Blog'));
                $repository->expects($this->once())
                        ->method('find')
                        ->with($this->equalTo(array('name' => 'foo')))
@@ -246,11 +246,11 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
 
        public function test_FindByConditionWithPlaceholders() {
-               $repository = new Tx_BlogExample_Domain_BlogRepository();
+               $repository = new Tx_BlogExample_Domain_Model_BlogRepository();
                $repository->dataMapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
                $repository->dataMapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
                        ->method('fullQuoteStr')
@@ -274,11 +274,11 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
 
        public function test_FindByConditionWithExample() {
-               $repository = new Tx_BlogExample_Domain_BlogRepository();
+               $repository = new Tx_BlogExample_Domain_Model_BlogRepository();
                $repository->dataMapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
                $repository->dataMapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
                        ->method('fullQuoteStr')
@@ -297,7 +297,7 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
        }
        
        public function test_MagicFindByPropertyUsesGenericFind() {
-               $repository = $this->getMock('Tx_BlogExample_Domain_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Blog'));
+               $repository = $this->getMock('Tx_BlogExample_Domain_Model_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Model_Blog'));
                $repository->expects($this->once())
                        ->method('find')
                        ->with($this->equalTo(array('name' => 'foo')))
index 0d67388..4e66c20 100644 (file)
@@ -27,7 +27,7 @@ require_once(PATH_tslib . 'class.tslib_content.php');
 class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_testcase {
        
        public function setUp() {
-               require_once(t3lib_extMgm::extPath('blogexample') . 'Classes/Domain/Blog.php');
+               require_once(t3lib_extMgm::extPath('blogexample') . 'Classes/Domain/Model/Blog.php');
        
                $GLOBALS['TSFE']->fe_user = $this->getMock('tslib_feUserAuth');
                $GLOBALS['TSFE'] = $this->getMock('tslib_fe', array('includeTCA'));
@@ -44,9 +44,9 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
        public function setupTCA() {
                global $TCA;
                global $_EXTKEY;
-               $TCA['tx_blogexample_domain_blog'] = array (
+               $TCA['tx_blogexample_domain_model_blog'] = array (
                        'ctrl' => array (
-                               'title'             => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_blog',
+                               'title'             => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_model_blog',
                                'label'                         => 'name',
                                'tstamp'            => 'tstamp',
                                'prependAtCopy'     => 'LLL:EXT:lang/locallang_general.xml:LGL.prependAtCopy',
@@ -54,7 +54,7 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
                                'enablecolumns'     => array (
                                        'disabled' => 'hidden'
                                ),
-                               'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'Resources/Icons/icon_tx_blogexample_domain_blog.gif'
+                               'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'Resources/Icons/icon_tx_blogexample_domain_model_blog.gif'
                        ),
                        'interface' => array(
                                'showRecordFieldList' => 'hidden, name, description, logo, posts'
@@ -69,7 +69,7 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
                                ),
                                'name' => array(
                                        'exclude' => 0,
-                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_blog.name',
+                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_model_blog.name',
                                        'config'  => array(
                                                'type' => 'input',
                                                'size' => 20,
@@ -79,7 +79,7 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
                                ),
                                'description' => array(
                                        'exclude' => 1,
-                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_blog.description',
+                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_model_blog.description',
                                        'config'  => array(
                                                'type' => 'text',
                                                'eval' => 'required',
@@ -89,7 +89,7 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
                                ),
                                'logo' => array(
                                        'exclude' => 1,
-                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_blog.logo',
+                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_model_blog.logo',
                                        'config'  => array(
                                                'type'          => 'group',
                                                'internal_type' => 'file',
@@ -104,12 +104,12 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
                                ),
                                'posts' => array(
                                        'exclude' => 1,
-                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_blog.posts',
+                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_model_blog.posts',
                                        'config' => array(
                                                'type' => 'inline',
                                                // TODO is 'foreign_class' in $TCA the best way?
-                                               'foreign_class' => 'Tx_BlogExample_Domain_Post',
-                                               'foreign_table' => 'tx_blogexample_domain_post',
+                                               'foreign_class' => 'Tx_BlogExample_Domain_Model_Post',
+                                               'foreign_table' => 'tx_blogexample_domain_model_post',
                                                'foreign_field' => 'blog',
                                                'foreign_table_field' => 'blog_table',
                                                'appearance' => array(
@@ -121,11 +121,11 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
                                ),
                                'author' => array(
                                        'exclude' => 1,
-                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_blog.author',
+                                       'label'   => 'LLL:EXT:blogexample/Resources/Language/locallang_db.xml:tx_blogexample_domain_model_blog.author',
                                        'config' => array(
                                                'type' => 'select',
-                                               'foreign_class' => 'Tx_BlogExample_Domain_Author',
-                                               'foreign_table' => 'tx_blogexample_domain_author',
+                                               'foreign_class' => 'Tx_BlogExample_Domain_Model_Author',
+                                               'foreign_table' => 'tx_blogexample_domain_model_author',
                                                'maxitems' => 1,
                                        )
                                ),
@@ -140,26 +140,26 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
        }
 
        public function test_DataMapCanBeInitialized() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $dataMap->initialize();
                $columnMaps = $dataMap->getColumnMaps();
                $this->assertEquals(12, count($columnMaps), 'The data map was not initialized (wrong number of column maps set).');
        }
        
        public function test_DeletedColumnNameCanBeResolved() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $deletedColumnName = $dataMap->getDeletedColumnName();
                $this->assertEquals($deletedColumnName, 'deleted', 'The deleted column name could not be resolved.');
        }
        
        public function test_HiddenColumnNameCanBeResolved() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $hiddenColumnName = $dataMap->getHiddenColumnName();
                $this->assertEquals($hiddenColumnName, 'hidden', 'The hidden column name could not be resolved.');
        }
        
        public function test_ColumnCanBeAdded() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $dataMap->addColumn('test_column');
                $columnMaps = $dataMap->getColumnMaps();
                $columnMap = array_pop($columnMaps);
@@ -167,7 +167,7 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
        }
        
        public function test_ColumnListCanBeRetrieved() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $dataMap->addColumn('column1');
                $dataMap->addColumn('column2');
                $dataMap->addColumn('column3');
@@ -177,20 +177,20 @@ class Tx_ExtBase_Persistence_Mapper_DataMap_testcase extends Tx_ExtBase_Base_tes
        }
        
        public function test_PersistablePropertyCanBeChecked() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $dataMap->addColumn('configured_property');
                $this->assertTrue($dataMap->isPersistableProperty('configuredProperty'), 'The persistable property was marked as unpersistable.');
                $this->assertFalse($dataMap->isPersistableProperty('unconfiguredProperty'), 'The unpersistable property was marked asersistable.');
        }
        
        public function test_HasManyColumnIsRegisteredForForeignTable() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $dataMap->initialize();
                $this->assertEquals(Tx_ExtBase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY, $dataMap->getColumnMap('posts')->getTypeOfRelation(), 'The posts relation was not of type HAS_MANY.');
        }
        
        public function test_HasOneColumnIsRegisteredForForeignTableWithMaxsizeOne() {
-               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Blog');
+               $dataMap = new Tx_ExtBase_Persistence_Mapper_DataMap('Tx_BlogExample_Domain_Model_Blog');
                $dataMap->initialize();
                $this->assertEquals(Tx_ExtBase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE, $dataMap->getColumnMap('author')->getTypeOfRelation(), 'The author relation was not of type HAS_ONE.');
        }
index 504ba96..5c3c56c 100644 (file)
@@ -43,7 +43,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                $mapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetchByConditions'));
                $mapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
                        ->method('fullQuoteStr')
@@ -55,7 +55,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                        ->with($this->equalTo('bar'))
                        ->will($this->returnValue('"bar"'));
                
-               $mapper->fetchByConditions('Tx_BlogExample_Domain_Blog',
+               $mapper->fetchByConditions('Tx_BlogExample_Domain_Model_Blog',
                        array(
                                array('name LIKE ? OR name LIKE ?', 'foo', 'bar'),
                                array('hidden = ?', FALSE)
@@ -67,7 +67,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                $mapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetchByConditions', 'getDataMap'));
                $mapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(tx_blogexample_domain_blog.blog_name = "foo") AND (tx_blogexample_domain_blog.hidden = 0)'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(tx_blogexample_domain_model_blog.blog_name = "foo") AND (tx_blogexample_domain_model_blog.hidden = 0)'));
 
                $columnMap1 = $this->getMock('Tx_ExtBase_Persistence_Mapper_ColumnMap', array('getColumnName'), array(), '', FALSE);
                $columnMap1->expects($this->once())
@@ -83,7 +83,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
 
                $dataMap->expects($this->at(0))
                        ->method('getTableName')
-                       ->will($this->returnValue('tx_blogexample_domain_blog'));
+                       ->will($this->returnValue('tx_blogexample_domain_model_blog'));
 
                $dataMap->expects($this->at(1))
                        ->method('getColumnMap')
@@ -92,7 +92,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
 
                $dataMap->expects($this->at(2))
                        ->method('getTableName')
-                       ->will($this->returnValue('tx_blogexample_domain_blog'));
+                       ->will($this->returnValue('tx_blogexample_domain_model_blog'));
 
                $dataMap->expects($this->at(3))
                        ->method('getColumnMap')
@@ -101,7 +101,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                
                $mapper->expects($this->any())
                        ->method('getDataMap')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'))
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'))
                        ->will($this->returnValue($dataMap));
                
                $GLOBALS['TYPO3_DB']->expects($this->at(0))
@@ -109,7 +109,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                        ->with($this->equalTo('foo'))
                        ->will($this->returnValue('"foo"'));
                
-               $mapper->fetchByConditions('Tx_BlogExample_Domain_Blog',
+               $mapper->fetchByConditions('Tx_BlogExample_Domain_Model_Blog',
                        array(
                                'blogName' => 'foo',
                                'hidden' => FALSE
@@ -121,7 +121,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                $mapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper', array('fetchByConditions', 'getDataMap'));
                $mapper->expects($this->once())
                        ->method('fetch')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('(tx_blogexample_domain_blog.hidden = 0) AND ((tx_blogexample_domain_author.name = "Christopher"))'));
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('(tx_blogexample_domain_model_blog.hidden = 0) AND ((tx_blogexample_domain_model_author.name = "Christopher"))'));
 
                $columnMap1 = $this->getMock('Tx_ExtBase_Persistence_Mapper_ColumnMap', array('getColumnName'), array(), '', FALSE);
                $columnMap1->expects($this->once())
@@ -131,12 +131,12 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                $columnMap3 = $this->getMock('Tx_ExtBase_Persistence_Mapper_ColumnMap', array('getChildClassName'), array(), '', FALSE);
                $columnMap3->expects($this->once())
                        ->method('getChildClassName')
-                       ->will($this->returnValue('Tx_BlogExample_Domain_Author'));
+                       ->will($this->returnValue('Tx_BlogExample_Domain_Model_Author'));
 
                $dataMap1 = $this->getMock('Tx_ExtBase_Persistence_Mapper_DataMap', array('getColumnMap', 'getTableName'), array(), '', FALSE);
                $dataMap1->expects($this->at(0))
                        ->method('getTableName')
-                       ->will($this->returnValue('tx_blogexample_domain_blog'));
+                       ->will($this->returnValue('tx_blogexample_domain_model_blog'));
                $dataMap1->expects($this->at(1))
                        ->method('getColumnMap')
                        ->with($this->equalTo('hidden'))
@@ -154,7 +154,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                $dataMap2 = $this->getMock('Tx_ExtBase_Persistence_Mapper_DataMap', array('getColumnMap', 'getTableName'), array(), '', FALSE);
                $dataMap2->expects($this->at(0))
                        ->method('getTableName')
-                       ->will($this->returnValue('tx_blogexample_domain_author'));
+                       ->will($this->returnValue('tx_blogexample_domain_model_author'));
                $dataMap2->expects($this->at(1))
                        ->method('getColumnMap')
                        ->with($this->equalTo('name'))
@@ -162,12 +162,12 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                
                $mapper->expects($this->at(0))
                        ->method('getDataMap')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'))
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'))
                        ->will($this->returnValue($dataMap1));
                
                $mapper->expects($this->at(1))
                        ->method('getDataMap')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Author'))
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Author'))
                        ->will($this->returnValue($dataMap2));
                
                $GLOBALS['TYPO3_DB']->expects($this->any())
@@ -175,7 +175,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper_testcase extends Tx_E
                        ->with($this->equalTo('Christopher'))
                        ->will($this->returnValue('"Christopher"'));
                
-               $mapper->fetchByConditions('Tx_BlogExample_Domain_Blog',
+               $mapper->fetchByConditions('Tx_BlogExample_Domain_Model_Blog',
                        array(
                                'hidden' => FALSE,
                                'author' => array(
index bb54821..caed137 100644 (file)
 
 class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcase {
        public function __construct() {
-               require_once(t3lib_extMgm::extPath('blogexample', 'Classes/Domain/BlogRepository.php'));
+               require_once(t3lib_extMgm::extPath('blogexample', 'Classes/Domain/Model/BlogRepository.php'));
        }
 
        public function test_FindDelegatesToDataMapperFind() {
         $this->markTestIncomplete('This test has not been fully implemented yet.');            
-               $repository = new Tx_BlogExample_Domain_BlogRepository();
+               $repository = new Tx_BlogExample_Domain_Model_BlogRepository();
                $repository->dataMapper = $this->getMock('Tx_ExtBase_Persistence_Mapper_DataMap', array('findWhere'), array(), '', FALSE);
                $repository->dataMapper->expects($this->once())
                        ->method('findWhere')
-                       ->with($this->equalTo('Tx_BlogExample_Domain_Blog'), $this->equalTo('foo'))
+                       ->with($this->equalTo('Tx_BlogExample_Domain_Model_Blog'), $this->equalTo('foo'))
                        ->will($this->returnValue(array()));
                
                $result = $repository->findWhere('foo');
@@ -42,7 +42,7 @@ class Tx_ExtBase_Persistence_Repository_testcase extends Tx_ExtBase_Base_testcas
 
        public function test_MagicFindByPropertyUsesGenericFind() {
                $this->markTestIncomplete('This test has not been fully implemented yet.');             
-               $repository = $this->getMock('Tx_BlogExample_Domain_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Blog'));
+               $repository = $this->getMock('Tx_BlogExample_Domain_Model_BlogRepository', array('find'), array('Tx_BlogExample_Domain_Model_Blog'));
                $repository->expects($this->once())
                        ->method('find')
                        ->with($this->equalTo(array('name' => 'foo')))
index b46df09..bb75b6e 100644 (file)
@@ -80,7 +80,6 @@ class Tx_ExtBase_Dispatcher {
                $parameters = t3lib_div::_GET();
                $extensionName = $configuration['extension'];
                $controllerName = $configuration['controller'];
-               // TODO Should we implement switched controllers?
                $allowedActions = t3lib_div::trimExplode(',', $configuration['allowedActions']);
                if (isset($parameters['action']) && in_array($parameters['action'], $allowedActions)) {
                        $actionName = stripslashes($parameters['action']);
@@ -98,8 +97,6 @@ class Tx_ExtBase_Dispatcher {
                }
 
                $arguments = t3lib_div::makeInstance('Tx_ExtBase_MVC_Controller_Arguments');
-               // SK: strtolower($extensionName) is wrong I think, as all underscores need to be removed as well.
-               // SK: Example: tt_news -> tx_ttnews
                // TODO Namespace for controller
                foreach (t3lib_div::GParrayMerged('tx_' . strtolower($extensionName) . '_' . strtolower($controllerName)) as $key => $value) {
                        $request->setArgument($key, $value);
@@ -113,7 +110,6 @@ class Tx_ExtBase_Dispatcher {
                        $controller->processRequest($request, $response);
                } catch (Tx_ExtBase_Exception_StopAction $ignoredException) {
                }
-               // debug($persistenceSession);
                $persistenceSession->commit();
                $persistenceSession->clear();