I don’t understand. When the model path of the model he want to access is nowhere defined (through import in config), how can the application itself access it?
Can you explain more or give example? I just tried it and didn’t worked.
I have a module in my application called ‘account’. My LoginForm model is under protected/modules/account/models. My login action is in SiteController located under protected/cotrollers with the action ‘login’ i.e actionLogin()…
The login action requires LoginForm from protected/modules/account/models.
I get it by doing this:
Yii::app()->getModule('account');
$LoginForm = new LoginForm;
When you generate a module with yiic, the web module will import the models and components of that module in the init method by default as shown here.
public function init()
{
// this method is called when the module is being created
// you may place code here to customize the module or the application
// import the module-level models and components
$this->setImport(array(
'account.models.*',
'account.components.*',
));
}