Youcef04 Youcef04 - 3 months ago 14
PHP Question

Import models in subdirectories Yii

I'm using the php framework Yii.

When i use:

yii::import('application.models.*');
, all models in models folder will be imported, but i have some models in the sub-directories:


  • "/models/subdir1/model1.php"

  • "/models/subdir1/subsubdir2/model2.php"

  • "/models/subdir1/subsubdir2/model3.php"

  • "/models/subdir1/subsubdir2/subsubsubdir3/model4.php"



there are many levels (3, 4 or perhaps 5), and i would like to import all of these models using:
yii::import('application.models.subdir1.*');


is there any solution to do that ??

and thanks in advance.

Answer

Although I can't find it in the guide, it should be available with

yii::import('application.models.subdir1.**');

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

[edit] Sorry, didn't read the full page, looks like it was reverted, but you could still get a specific revision to get the code, but it's not recommended by qiang.

Comments