Reputation: 365
I'm trying to create a controller inside a module using the Zend_Tool doing this:
$ zf create module admin
$ zf create controller login admin
With the first command it creates de module hierarchy, but in the second command it creates the controller and view into the default namespace.
Is it something that I'm doing wrong?
Thanks.
H.C.
Upvotes: 12
Views: 11883
Reputation: 9411
You have also command for creating action inside of module:
create action <actionname> <controller name> 1 <modulename>
(1 stands for boolean that you want to create view script as well)
Unfortunatelly you cannot create view inside of module! :(
The command format for creating view is as follows (as of the version of ZF 1.11.6, I created new issue in Zend Framework issue tracker regarding it):
create view <controller name> <actionname>
as you can see <modulename> parameter is missing
but if you are able to edit PHP code and you are :) than you can simple edit your Zend Framework "Zend\Tool\Project\Provider\View.php" and
extend line 95 into
public function create($controllerName, $actionNameOrSimpleName, $module = null)
and line 105 into
$view = self::createResource($profile, $actionNameOrSimpleName, $controllerName, $module);
and that is it!
Now you can create view inside of specified module
create view <controller name> <actionname> <modulename>
Upvotes: 2
Reputation: 81
zf create controller <controllername> 1 <modulename>
zf create controller <controllername> -m <modulename>
zf create controller <controllername> --module=<modulename>
Upvotes: 8
Reputation: 20736
zf create module admin zf create controller login index-action-included[=1] admin
But i think you have to change the class name for the logincontroller manualy to admin_logincontroller.
Upvotes: 16