/**
  * cover all cases:
  * 1. extend TYPO3 class like fe_users (no mapping table needed)
  *
  * @param Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject
  */
 private function validateMapping(Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject)
 {
     $parentClass = $domainObject->getParentClass();
     $tableName = $domainObject->getMapToTable();
     $extensionPrefix = 'Tx_' . t3lib_div::underscoredToUpperCamelCase($domainObject->getExtension()->getExtensionKey()) . '_Domain_Model_';
     if (!empty($parentClass)) {
         $classConfiguration = $this->configurationManager->getExtbaseClassConfiguration($parentClass);
         t3lib_div::devlog('class settings ' . $parentClass, 'extension_builder', 0, $classConfiguration);
         if (!isset($classConfiguration['tableName'])) {
             if (!$tableName) {
                 $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('Mapping configuration error in domain object ' . $domainObject->getName() . ': The mapping table could not be detected from Extbase Configuration. Please enter a table name', self::ERROR_MAPPING_NO_TABLE);
             }
         } else {
             // get the table name from the parent class configuration
             $tableName = $classConfiguration['tableName'];
         }
         if (!class_exists($parentClass, TRUE)) {
             $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('Mapping configuration error in domain object ' . $domainObject->getName() . ': the parent class ' . $parentClass . 'seems not to exist ', self::ERROR_MAPPING_NO_PARENTCLASS);
         }
     }
     if ($tableName) {
         if (strpos($extensionPrefix, $tableName) !== FALSE) {
             // the domainObject extends a class of the same extension
             if (!$parentClass) {
                 $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('Mapping configuration error in domain object ' . $domainObject->getName() . ': you have to define a parent class if you map to a table of another domain object of the same extension ', self::ERROR_MAPPING_NO_PARENTCLASS);
             }
         }
         if (!isset($GLOBALS['TCA'][$tableName])) {
             $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('There is no entry for table "' . $tableName . '" of ' . $domainObject->getName() . ' in TCA. For technical reasons you can only extend tables with TCA configuration.', self::ERROR_MAPPING_NO_TCA);
         }
     }
     if (isset($GLOBALS['TCA'][$tableName]['ctrl']['type'])) {
         $dataTypeRes = $GLOBALS['TYPO3_DB']->sql_query('DESCRIBE ' . $tableName);
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dataTypeRes)) {
             if ($row['Field'] == $GLOBALS['TCA'][$tableName]['ctrl']['type']) {
                 if (strpos($row['Type'], 'int') !== FALSE) {
                     $this->validationResult['warnings'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('The configured type field for table "' . $tableName . '" is of type ' . $row['Type'] . '<br />This means the type field can not be used for defining the record type. <br />You have to configure the mappings yourself if you want to map to this<br /> table or extend the correlated class', self::ERROR_MAPPING_WRONG_TYPEFIELD_CONFIGURATION);
                 }
             }
         }
     }
 }