Access module models ?
Posted 19 April 2010 - 05:03 AM
Posted 20 April 2010 - 04:19 AM
Yii::setPathOfAlias('MyAlias','path/to/the/module'); Yii::import('MyAlias.models.DesiredModel'); // this will include the class DesiredModel immediately $model = Yii::createComponent('DesiredModel');
Make sure your import specifies the path to a particular class (i.e. don't use a wildcard) so the class will be included immediately.
Posted 21 April 2010 - 01:41 AM
The class will not included immediately unless you pass in the value 'true' to the second argument in the import function to force include the class. other wise it will be included when needed.
Posted 21 April 2010 - 04:37 AM
Oops, yes you're right, forgot about that: