Why are my camel cased actions in Zend MVC attempting to call non-camelcased method names?

The Zend standard for action names is camelCase, yet if I create an action with camel casing, the request fails because it tries to call the method (action) without the camel casing!

Example:

I have an action named "changeEmail" in module "abc". The method is "changeEmailAction" (created by Zend Tool). If I try to access /abc/changeEmail, I get an error returned that says 'Message: Action "changeemail" does not exist and was not trapped in __call()'.

The ONLY way I have been able to make it work is by only creating action names in all lowercase. This makes for terrible readability and is contrary to the suggested naming convention. What am I missing?

Answers


The default behavior of a Zend Framework Action Controller/Router is to enforce a URL naming scheme of all lowercase, with dashes separating the words.

http://example.com/controller/my-thing

When this URL is translated into an action name, camel casing is applied.

public function myThingAction()
{
}

If you really really really want URLs that are camel cased, you should look into configuring your application with a custom Zend Router


I found the answer to this:

In the url, for multi-word action names, you must separate the words with hyphens, i.e.

/abc/change-email

will call the method "changeEmailAction" in the controller.


You should use hyphen-seperated names in your URLs, e.g. /abc/change-email.


Need Your Help

Media Queries - Generic Responsive Templates

html css3 media-queries

I want to create generic responsive templates,

PHP crawler not working for wikipedia

php parsing web-crawler wiki

Below is my php code to output the text under the id=Summary. Well this script is working fine for other webistes but not for wikipedia.I have also pasted the error I am getting below. Is wikipedia