Want to import all models in modules Yii2
I want to use all the models in app/models in my modules app/modules/main and app/modules/admin. I have around 60+ models and these models will be used in main module as well as admin module. I want to import all these models in the modules. How can i do it?
In Yii1.x the import can be done in Module.php file with this code
$this->setImport(array( 'main.models.*', 'main.components.*', ));
How it can be achieved it Yii2.
Also i want to use all models in controllers. Is there any possibility that instead of adding each model in the controller can it be includes with one code of line??
I suppose that if you import all these PHP code, you will run out of memory or you will get an error at the end. Even if it works, definitely this is not efficient.
Why you need to load/import everything anyway??