Reputation: 8696
I created a module and controller using:
$ zf create module api
$ zf create controller auth index-action-included=1 api
This works fine, and I get the index action when I request http://localhost/api/auth
.
I want to create a new action called validate:
$ zf create action validate auth view-included=1 api
But I get told that:
An Error Has Occurred
Controller auth was not found.
Edit:
I have directly added the action in the controller, and created the view file - but I hope I don't miss anything else I need here that the command line should have created.
Upvotes: 4
Views: 3374
Reputation: 1506
I had the same problem:
zf create controller Account
...
zf create action list Account
An Error Has Occurred
Controller Account was not found.
The cause seems to be that create controller
command doesn't add section into of the .zfproject file:
<controllersDirectory>
<controllerFile controllerName="Index">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Error"/>
</controllersDirectory>
Workaround: I added manually <controllerFile controllerName="Account">
<controllersDirectory>
<controllerFile controllerName="Index">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Account">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Error"/>
</controllersDirectory>
After this zf create action list Account
was executed successfully.
Upvotes: 3
Reputation: 8856
The command should be like this:
$ zf create action validate -c auth
For details zend commands
Upvotes: 4