Hi , I have Yii2 advanced application template and want have active record table model class in other directory than frontend/models.For example frontend/dbmodels.This is possible ? I did not find similar topic.
If is possible what I need to do.
Hi , I have Yii2 advanced application template and want have active record table model class in other directory than frontend/models.For example frontend/dbmodels.This is possible ? I did not find similar topic.
If is possible what I need to do.
Of course it is possible
Change the namespace in the files that you are moving.
And adjust the namespace used where you reference them.
Like:
<?php
namespace frontend\dbmodels;
Yii 2 uses http://www.php-fig.org/psr/psr-4/ so check that out if you are curious - the examples are good.
Also you can create in app root ‘common/models’ folder and contain common model, which you want to use in front and back ends. And namespace will be app\common\models;
Thanks guys for help.Now I know how it works
Topic can be closed.