Issues

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

Issue Type: Bug Created: 2009-07-14T16:29:53.000+0000 Last Updated: 2009-10-16T22:16:17.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Jake McGraw (jakemcgraw) Assignee: Ralph Schindler (ralph) Tags: - Zend_Tool

Related issues: Attachments:

Description

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

becomes:

zf create action myHyphenatedAction mycontroller

Comments

Posted by Enrico Faifer (splufer) on 2009-08-17T03:12:34.000+0000

If I digit

zf create action myHyphenatedAction mycontroller

then I have a problem with view :

myproject/application/views/scripts/mycontroller/myHyphenatedAction.phtml

Posted by Ralph Schindler (ralph) on 2009-08-17T08:17:16.000+0000

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

Posted by Mark Smith (mark_79_smith) on 2009-10-02T11:02:07.000+0000

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.

Posted by Ralph Schindler (ralph) on 2009-10-16T22:16:17.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts