Autoloading of php classes

Hi,

In the main.php config file you can configure under ‘import’ => … which classes you want to autoload.

Example:


	

'import'=>array(

		'application.models.*',

		'application.components.*',

	),



Here it loadas all classes in the folder models and components. whats the best solution withouth to write all subfolders etc here, to load also the classes in the subfolders in models etc.?

thanks for help.

If you have placed models in subfolders of models and you do not want to write all those subfolders there, then I believe that the best way is to register your own autoload function for those folders. In this way you make sure Yii wont fail to load those…

http://www.yiiframework.com/doc/api/1.1/YiiBase#registerAutoloader-detail

Also check out the discussion of this issue:

http://code.google.com/p/yii/issues/detail?id=1568