Hello,
not sure what the syntax is for using models created in own module.
Thanks
Hello,
not sure what the syntax is for using models created in own module.
Thanks
class MymoduleModule extends CWebModule{
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(
'mymodule.models.*',
'mymodule.components.*',
));
}
}
in the module controllers:
ModelInMyModuleModelsFolder::model()->findBYPk(1);
Also, you can import your models application wide in config/main.php, like:
'import'=>array(
'application.modules.mymodule.models.*',
),
Ans use it the same as above.
Thank you