DatsunBing
DatsunBing

Reputation: 9076

Zend Framework: Action controller naming rules

I am unclear on the naming rules for Actions using stadard routing, etc, in the Zend Framework. Am I limited to using lowercase letters only? And if so, how do other developers deal with the lack of flexibility?

The Standard Naming Conventions in the Zend Documentation (http://framework.zend.com/manual/en/coding-standard.naming-conventions.html) say that functions should be camelCased. There's no mention of any exception for Action functions.

Other sources (such as this cheatsheet http://www.ideveloper.de/weblog/zend-framework-cheat-sheet.pdf) agree with this, however camelCased Actions don't work for me. The router converts the URL to lowercase before looking for the Action.

When the user requests createNewUser, Zend looks for the function createnewuserAction().

Any assistance appreciated!

Upvotes: 3

Views: 3028

Answers (2)

Frank Thoeny
Frank Thoeny

Reputation: 310

You could name the controller FooController but I don't think FooFooController.

If I'm correct the Second word that begins with a capitalized letter has to be the word Controller.

Upvotes: 1

timdev
timdev

Reputation: 62894

CamelCase in the action names maps to hyphenation in the URL.

For example, a url like: /foo/some-thing maps to FooController::someThingAction()

Upvotes: 10

Related Questions