Hi,
i have been using the basic yii application template for a while now and built my application. Now I want to extend the whole thing with an api. The documentation says that it is best practice to use a seperate folder for it. So I moved all folders (controller, config, components…) to a folder called "frontend" that lays in the root directory beside vendor. I changed the paths in frontend/web/index.php and frontend/config/web.php and it works. Now I want to move classes like models to a common directory, so that I can use them also in my api. I moved the models to common/models/ and changed the namespace to \common\models. In all controller classes (located in frontend\controllers), I have changed the model namespace also (use \common\models\MyModel). But sadly yii does not find my models. A "Class not found" exception is thrown.
I have seen that the advanced application template uses a similar structure. Why does it not work when I modify it as described by hand?
//Found the solution by myself: You have to define path aliases to frontend, api, common as in the advanced application template (common/config/aliases.php).