Youcef04 Youcef04 - 2 months ago 10x
PHP Question

Import models in subdirectories Yii

I'm using the php framework Yii.

When i use:

, 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:

is there any solution to do that ??

and thanks in advance.


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


[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.