Model Directory

Hi

I would like to load Model from directories in model

It’s a god when my model is in model directory:

protected\models

and i make this with:

but how can I make this when my model is in for example:protected\models\somethingfolder\ ?

please help

If you want to make the directory available system wide, update the imports in your config file:




	// autoloading model and component classes

	'import'=>array(

		...

		'application.models.somethingfolder.*',


	),




If you only use the class in specific places, you can import it before you first use it:




Yii::import('application.models.somethingfolder.SomethingModel');

// Or Yii::import('application.models.somethingfolder.*');


$somethingModel = new SomethingModel;



Thank you :)

hey, it is amazing, thanks