[TASK] Streamline creation of column maps
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / Generic / Mapper / DataMapFactory.php
index 12ac9c7..76c5ca7 100644 (file)
@@ -173,7 +173,7 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface {
                                $propertyName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($columnName);
                        }
                        // if (in_array($propertyName, $classPropertyNames)) { // TODO Enable check for property existance
-                       $columnMap = new \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap($columnName, $propertyName);
+                       $columnMap = $this->createColumnMap($columnName, $propertyName);
                        $propertyMetaData = $this->reflectionService->getClassSchema($className)->getProperty($propertyName);
                        $columnMap = $this->setRelations($columnMap, $columnDefinition['config'], $propertyMetaData);
                        $dataMap->addColumnMap($columnMap);
@@ -403,6 +403,18 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface {
                return $columnMap;
        }
 
+       /**
+        * Creates the ColumnMap object for the given columnName and propertyName
+        *
+        * @param string $columnName
+        * @param string $propertyName
+        *
+        * @return \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap
+        */
+       protected function createColumnMap($columnName, $propertyName) {
+               return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', $columnName, $propertyName);
+       }
+
 }
 
 ?>
\ No newline at end of file