/** * Gets own templates, as well as those from generators.model * @return array */ public function getTemplates() { $templates = parent::getTemplates(); foreach (Yii::app()->getModule('gii')->generatorPaths as $path) { $path = Yii::getPathOfAlias($path . '.model.templates'); if (is_dir($path)) { foreach (scandir($path) as $dir) { if ($dir[0] !== '.' && is_dir($path . '/' . $dir)) { $templates[$dir] = strtr($path . '/' . $dir, array('/' => DIRECTORY_SEPARATOR, '\\' => DIRECTORY_SEPARATOR)); } } } } return $templates; }