Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii 2 gii is generating view files on different directory

I am new to yii framework. On yii version:2.0.1 I have created a module in which I tried to generate a CRUD model using the gii functionality.
After putting the model class, controller class and view path when I clicked on generate gii showed all the files has been created successfully.
But when I tried to view, below message has been shown to me,

The view file does not exist :

C:\xampp\htdocs\advanced\backend\modules\settings\views\companies\index.php

I found the view files in web directory not in the path I entered. Hence the error.

Here is my inputs to gii,

Model Class:

backend\modules\settings\models\Companies

Search Model Class:

backend\modules\settings\models\CompaniesSearch

Controller Class:

backend\modules\settings\controllers\CompaniesController

View Path:

backend\modules\settings\views\companies

When I click generate I have given below message :

Generating code using template "C:\xampp\htdocs\advanced\vendor\yiisoft\yii2-gii\generators\crud/default"...

generated modules\settings\controllers\CompaniesController.php

generated modules\settings\models\CompaniesSearch.php

generated backend\modules\settings\views\companies\_form.php

generated backend\modules\settings\views\companies\_search.php

generated backend\modules\settings\views\companies\create.php

generated backend\modules\settings\views\companies\index.php

generated backend\modules\settings\views\companies\update.php

generated backend\modules\settings\views\companies\view.php

done!

Does anybody have any idea why is it happening.

Thanks in advance.

like image 254
sidrat Avatar asked Jan 12 '15 06:01

sidrat


1 Answers

I solved similar problem by changing

backend\modules\settings\views\companies

into

@backend/modules/settings/views/companies

Hopefully it helps someone in future

like image 160
Marek Avatar answered Nov 15 '22 19:11

Marek