Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 727
DatsunBing Avatar asked Apr 08 '26 18:04

DatsunBing


2 Answers

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

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

like image 144
timdev Avatar answered Apr 13 '26 06:04

timdev


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.

like image 35
Frank Thoeny Avatar answered Apr 13 '26 07:04

Frank Thoeny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!