ZF-11582: Dispatcher incorrectly transforms camelCased controller names into class names

Issue Type: Bug Created: 2011-07-20T10:33:16.000+0000 Last Updated: 2011-07-20T13:37:58.000+0000 Status: Resolved Fix version(s): Reporter: Dmitry Plenkin (sukebe) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: Attachments:


There is a method formatControllerName() in Zend_Controller_Dispatcher_Abstract class. Given the controller name like 'configurationTestGroups' it converts it into 'ConfigurationtestgroupsController'.

Problem arised when I was using custom routes like this (via application.ini): resources.router.routes.cfgApp.route = "/configuration/testGroups/:action/*" resources.router.routes.cfgApp.defaults.controller = "configurationTestGroups" resources.router.routes.cfgApp.defaults.action = "index"


Posted by Matthew Weier O'Phinney (matthew) on 2011-07-20T13:37:41.000+0000

Within the MVC, the controller and action names are passed lower-case; this helps ensure that the URLs may be case insensitive. As such, in order to translate these tokens to the MixedCase of class names or camelCase of method names, you need to introduce word separators -- usually "." or "-".

So, change this:

<pre class="highlight">
resources.router.routes.cfgApp.defaults.controller = "configurationTestGroups"

to this:

<pre class="highlight">
resources.router.routes.cfgApp.defaults.controller = "configuration-test-groups"

and the dispatcher should now invoke the ConfigurationTestGroupsController.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.