Yii2: Camel case controller name not well supported

Created on 5 Jun 2013  路  5Comments  路  Source: yiisoft/yii2

I created a controller named ContentManagementController, but I was not able to access it with index.php?r=ContentManagement. I tried many other URLs before I gave up to rename the controller with lower case "M".

URL I've tried but failed:
index.php?r=ContentMangement
index.php?r=contentMangement
index.php?r=contentmangement

Work around:
I renamed ContentManagementController to ContentmanagementController and it worked.

System:
Linux
PHP 5.4.6

Maybe I'm just missing something...

Thanks,

/Francis

Most helpful comment

yii2 uses more seo friendly url for camel case controller. All camel case is converted to lowercase with dash like this: index.php?r=content-mangement

All 5 comments

yii2 uses more seo friendly url for camel case controller. All camel case is converted to lowercase with dash like this: index.php?r=content-mangement

Controller name: ContentManagementController
View path generated using gii: views/contentManagement/
URL used according to the lowercase with dash: content-management
View path requested for the rendering due to the controller URL: views/content-management/index.php

I think it can be solved by simply renaming the views folder to 'content-management' but this might be a gii bug then.

View path generated using gii: views/contentManagement/

if that really happens with gii, it is a bug and should be fixed, but it worked for me before. please report this to https://github.com/yiisoft/yii2-gii if you have a way to reproduce it.

Is it just me or did this bug never get reported/fixed? I just ran into the same problem.

did you read http://www.yiiframework.com/doc-2.0/guide-structure-controllers.html#controller-ids and https://github.com/yiisoft/yii2/issues/493#issuecomment-18943020 ?
in case you are referring to gii, please create an issue on https://github.com/yiisoft/yii2-gii as pointed out above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

njasm picture njasm  路  44Comments

cebe picture cebe  路  53Comments

alexraputa picture alexraputa  路  53Comments

samdark picture samdark  路  63Comments

AstRonin picture AstRonin  路  49Comments