Hi All,
I have a module and in the default action index in SiteController I would like to retrieve information from a model currently located in a module, I just can’t do it! Yii is trying to look for the model file into protected/models folders, any idea?
Thanks!
You just have to "import" the model classes in your module.
Yii::import('application.modules.mymodule.models.MyModel'); // or // Yii::import('application.modules.mymodule.models.*'); ... $model = new MyModel();
http://www.yiiframework.com/doc/guide/1.1/en/basics.namespace#importing-classes
You may import them in "config/main.php" if you need them regularly.
'import'=>array( 'application.models.*', 'application.components.*', 'application.modules.mymodule.models.*', ... ),
Oh God… What stupid question I made! I forgot that! Thanks softark!