ZF-7276: "zf create action" cannot properly handle hyphenated action names


Currently, the zf command (which utilizes Zend_Tool_Project) cannot handle action names with hyphens:

%> zf create project myproject myproject %> cd myproject %> zf create controller mycontroller %> zf create action my-hyphenated-action mycontroller %> cat application/controllers/MycontrollerController.php

... public function my-hyphenated-actionAction() { ... } ...

For the time being, to get around this issue (while working with the default router), remove the hyphens and capitalize the first letter of section of the action name after the first:

zf create action my-hyphenated-action mycontroller


zf create action myHyphenatedAction mycontroller


If I digit

zf create action myHyphenatedAction mycontroller

then I have a problem with view :


Changed to "Bug" since it produces unworking code. Marked as "Major" and for "Next mini release"

There is also a problem when the controller is created with a hyphen. eg. zf create controller about-us Creating a controller at /home/sites/application/controllers/About-usController.php Creating an index action method in controller about-us Creating a view script for the index action method at /home/sites/application/views/scripts/about-us/index.phtml Creating a controller test file at /home/sites/tests/application/controllers/About-usControllerTest.php Updating project profile '/home/sites/.zfproject.xml'

The contents of About-usController.php is: <?php class AboutUsController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ }

public function indexAction()    {        // action body    }


The class name is what I'd expect but because the file name includes the hyphen the autoloader cannot find the file and therefore trying to access /about-us fails to load.

Fixed in r18631 in incubator. Will be included in 1.10 release