ZF-6585: Cant create actions in Index controller

Description

Im trying to create a action in IndexController via zf.bat - but somehow it doesnt work. It works fine when I create actions in an another controller.

The project is created with d:\path\to\zf.bat create project . (from the directory where I want it to be created) Worked perfectly.

Then I copied zf.bat and zf.php to the directory (so I didnt have to type d:/path/to/zf.bat anymore. Now I created a new controller, and added some actions with zf.bat create controller User zf.bat create action login User zf.bat create action logout User (and some more)

Then I tried to create some new actions in indexController zf.bat create action send Index Then this error came

PHP Fatal error: Call to a member function search() on a non-object in ...\Zend\Tool\Project\Provider\Action.php on line 85 Fatal error: Call to a member function search() on a non-object in ...\Zend\Tool\Project\Provider\Action.php on line 85

Then I tried to create another action with a name which worked perfectly in my userController zf.bat create action login Index same error

Comments

Hi. This behaviour occurs when you're trying to add an action to unknown controller.

Try to use this command (with small I letter in controller name):

zf.bat create action send index

It should work.

My bugtrack:

Zend_Tool_Project_Provider_Action::hasResource()

contains :

$controllerFile = self::_getControllerFileResource($profile, $controllerName, $moduleName);

now, when you specify unknown controller, it returns false, as defined in Zend_Tool_Project_Profile_Resource_Container::find(). It should definitely either throw a warning, if the $controllerFile === false saying it's case sensitive, maybe explain it a little bit. Maybe it could be good to try to lower the first letter in the find() function before giving up the controller search...

Actually i have switched to zf.sh, and in the controller help, there stands you shouldnt add controller name if you are adding actions to the index controller. Im not sure if this also stands in the zf.bat file.

But yes, a bit nicer error would be a great addition.

Also in zf.sh, it works with both lower- and uppercase controller name / action names...

This has been fixed in part with other issues affecting the controller & view providers: ZF-7960, ZF-7956, ZF-7098, ZF-7276 ZF-6787

This will be included in the 1.10 release.