/**
  * @return Tx_Extbase_Persistence_Mapper_DataMap
  */
 public function getDataMap($className)
 {
     switch ($className) {
         case 'Tx_Doctrine2_Tests_Model_Post':
             $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap('Tx_Doctrine2_Tests_Model_Post', 'posts');
             $dataMap->setPageIdColumnName('pid');
             $dataMap->setLanguageIdColumnName('lid');
             return $dataMap;
     }
 }
 public function testLoadMetadataForClassWithProperties()
 {
     $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap('Tx_Doctrine2_Tests_Model_Post', 'posts');
     $column = new Tx_Extbase_Persistence_Mapper_ColumnMap('post_headline', 'headline');
     $column->setTypeOfRelation(Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_NONE);
     $dataMap->addColumnMap($column);
     $this->metadataService->expects($this->once())->method('getDataMap')->will($this->returnValue($dataMap));
     $metadata = $this->loadClassMetadata('Tx_Doctrine2_Tests_Model_Post');
     $this->assertEquals('posts', $metadata->getTableName());
     $this->assertEquals(array(), $metadata->identifier, 'No identifier, this this inherited from abstract class');
     $this->assertEquals(array('post_headline' => 'headline'), $metadata->fieldNames);
 }
Esempio n. 3
0
 protected function addMetaDataColumnNames(Tx_Extbase_Persistence_Mapper_DataMap $dataMap, $tableName)
 {
     $controlSection = $GLOBALS['TCA'][$tableName]['ctrl'];
     $dataMap->setPageIdColumnName('pid');
     if (isset($controlSection['tstamp'])) {
         $dataMap->setModificationDateColumnName($controlSection['tstamp']);
     }
     if (isset($controlSection['crdate'])) {
         $dataMap->setCreationDateColumnName($controlSection['crdate']);
     }
     if (isset($controlSection['cruser_id'])) {
         $dataMap->setCreatorColumnName($controlSection['cruser_id']);
     }
     if (isset($controlSection['delete'])) {
         $dataMap->setDeletedFlagColumnName($controlSection['delete']);
     }
     if (isset($controlSection['languageField'])) {
         $dataMap->setLanguageIdColumnName($controlSection['languageField']);
     }
     if (isset($controlSection['transOrigPointerField'])) {
         $dataMap->setTranslationOriginColumnName($controlSection['transOrigPointerField']);
     }
     if (isset($controlSection['type'])) {
         $dataMap->setRecordTypeColumnName($controlSection['type']);
     }
     if (isset($controlSection['enablecolumns']['disabled'])) {
         $dataMap->setDisabledFlagColumnName($controlSection['enablecolumns']['disabled']);
     }
     if (isset($controlSection['enablecolumns']['starttime'])) {
         $dataMap->setStartTimeColumnName($controlSection['enablecolumns']['starttime']);
     }
     if (isset($controlSection['enablecolumns']['endtime'])) {
         $dataMap->setEndTimeColumnName($controlSection['enablecolumns']['endtime']);
     }
     if (isset($controlSection['enablecolumns']['fe_group'])) {
         $dataMap->setFrontEndUserGroupColumnName($controlSection['enablecolumns']['fe_group']);
     }
     return $dataMap;
 }