I’m having an issue when I set different value on View Path of Gii CRUD generator.
The table name is: mst_employees
First, the View Path is left default (no value) it will create "mst-employees" on my backend views directory.
Then it can be accessed normally at $MYDOMAIN/mst-employees/
But when I set the View Path with “@backend\views\mstemployees” (change mst-employees to mstemployees), it will create mstemployees views directory normally, but I can’t access the path: $MYDOMAIN/mstemployees/
It will create 404 error.
What causing this strange issues?
Thanks,
[bayu]
PS: $MYDOMAIN is the full URL path of my local domain, since this is my first post which not allowed to post URL.
I’m not sure but maybe you must change the default view path in your controller. property $_viewPath. use the method setViewPaht([color="#1C2837"][size=“2”]"@backend\views\mstemployees"[/size][/color][size=“2”]) in you init function.[/size]
Hence if you said “MstEmployeesController” has the controller ID of ‘mst-employees’, I still confuses on which part or rules define about it. Or it was an inclusive / default format relates to a table name?
At Gii, I created MstEmployeesController; not Mst-EmployeesController.
Well, the previous description about the rule was not completely correct. It was upside down.
It’s not the controller ID but the controller class name that is automatically generated by convention.
controller ID | class name
--------------+-----------------
abc | AbcController
xyz | XyzController
abc-xyz | AbcXyzController
abc-xyz-long | AbcXyzLongController
split controller ID by "-" : e.g. abc-xyz -> abc, xyz
capitalize the initial letters : abc, xyz -> Abc, Xyz
join words : e.g. Abc, Xyz -> AbcXyz
append "Controller" : e.g. AbcXyz -> AbcXyzController
The controller ID is given in the request, usually as a part of the url. Then the application will search for the controller that matches the controller ID. Controller Map may be used to override the convention above. When the matching controller has not been found, then 404 exception will be thrown.