Пример #1
0
 /**
  * create all table's dto and dao
  *
  * @access public
  */
 function autoCreate()
 {
     $fileUtility = new FileUtility();
     $stringUtility = new StringUtility();
     $tableDefinitionDao = new TableDefinitionDao();
     $tableNameArray = $tableDefinitionDao->getTableNameList();
     $fileNameArray = array();
     $generationGapSuffix = GENERATIONGAP_SUFFIX;
     $baseDaoGenerator = new BaseDaoGenerator();
     $baseDao = $baseDaoGenerator->createBaseDaoClass();
     $fileUtility->writePhpFile(OUTPUT_DIR . "BaseDao", $baseDao);
     $fileNameArray[] = "BaseDao";
     $dtoGenerator = new DtoGenerator();
     $dto = $dtoGenerator->createDto();
     $fileUtility->writePhpFile(OUTPUT_DIR . $className . "TableDto", $dto);
     $fileNameArray[] = $className . "TableDto";
     foreach ($tableNameArray as $tableName) {
         $className = $stringUtility->getClassName($tableName);
         $columnList = $tableDefinitionDao->getColumnList($tableName);
         $primaryKeyList = $tableDefinitionDao->getPrimaryKeyList($tableName);
         $daoGenerator = new DaoGenerator();
         if (USE_BASE_CLASS) {
             $dao = $daoGenerator->createDao($tableName, $columnList, $primaryKeyList[0], "BaseDao");
         } else {
             $dao = $daoGenerator->createDao($tableName, $columnList, $primaryKeyList[0]);
         }
         $fileUtility->writePhpFile(OUTPUT_DIR . $className . "Dao", $dao);
         $fileNameArray[] = $className . "Dao";
     }
     return $fileNameArray;
 }