Example #1
0
 protected function getPath($dirPath, $table, $buildType = self::TYPE_SIMPLE)
 {
     $pieces = explode('_', $table);
     array_shift($pieces);
     $dirPath = rtrim(trim($dirPath), "/") . "/";
     switch ($buildType) {
         case self::TYPE_EXTJS:
             $dirPath .= 'Extjs/';
             break;
     }
     if (!file_exists($dirPath)) {
         File::rmkdir($dirPath, 0755, true);
     }
     if (count($pieces) > 1) {
         $modelName = ucfirst(array_pop($pieces));
         $line = '';
         foreach ($pieces as $piece) {
             $line .= ucfirst($piece) . '/';
         }
         $path = $dirPath . $line;
         if (!file_exists($path)) {
             File::rmkdir($path, 0755, true);
         }
         $path = rtrim(trim($path), "/") . "/";
         $modelsDirPath = $path . $modelName . '.php';
     } else {
         $modelsDirPath = $dirPath . $this->getClassName($table) . '.php';
     }
     return $modelsDirPath;
 }