Hi everyone, i have an admin interface built with yii, using nested modules.
The main structure at the config file would be:
'modules' => array(
'admin' => array(
'modules' => array(
'countries',
'states',
'cities',
'profiles',
'banners'
)
),
),
Every module extends from AdminModule, having the following init() function:
public function init() {
$idd = str_replace('/','.',$this->id);
$this->setImport(array(
"{$idd}.models.*",
"{$idd}.components.*",
));
$this->setComponents(array(
'errorHandler' => array(
'errorAction' => "admin/default/error"),
'user' => array(
'class' => 'CWebUser',
'loginUrl' => Yii::app()->createUrl("admin/default/login"),
'allowAutoLogin' => true,
),
));
Yii::app()->user->setStateKeyPrefix("_admin");
}
Here comes the problem… For some reason i want to load a particular model within BannerModule, but, import doesn’t work, because the ID generated for the model is the following “adminadmin/banners” instead of “admin/banners”. I don’t know how ID is generated and I know i could make a specific init() function for the BannerModule, but my intention is not to make that, so this way the code stays cleaner.