I had the need to use Gii to create nested modules so I’ve made a few changes in the file " framework / gii / generators / module / moduleCode.php " to attend it to my needs
Using the modifications below you can do this
"forum.accounts"
to create a module “accounts” in forum’s module
You guys should consider to include it into the new version
line 12:
//allows it to accept dot caracters in the module's name
array('moduleID', 'match', 'pattern'=>'/^(\w|\.)+$/', 'message'=>'{attribute} should only contain word characters.'),
I’ve also added a method to get the relative path of the module
//function to get the relative path of the module
public function getModuleRelativePath(){
$modulesFolder=substr(Yii::app()->modulePath,strrpos(Yii::app()->modulePath,DIRECTORY_SEPARATOR)+1);
foreach(explode(".",$this->moduleID) as $module){
@$path.=DIRECTORY_SEPARATOR.$modulesFolder.DIRECTORY_SEPARATOR.$module;
}
return $path;
}
so I’ve modified the methods getModuleClass and getModulePath to this
public function getModuleClass()
{
$dotPos=strpos($this->moduleID,".")>0 ? strrpos($this->moduleID,".")+1 : strpos($this->moduleID,".");
return ucfirst(substr($this->moduleID,$dotPos)).'Module';
}
public function getModulePath()
{
return Yii::app()->basePath.$this->getModuleRelativePath();
}
The success message neither the tip text isnt changed tho.
or you can replace the file with this one : 969
file to replace:
framework/gii/generators/module/ModuleCode.php
hope someone find this usefull