I am building a system in ZF2, in one controller
I have many different forms, but in the same module I have many controller
with many forms, and to make everything more orderly I want to create a subdirectory in the folder Forms
called Specials
and leave all my special forms there, leaving my directory structure as follows
module/
Account/
config/
Controller/
Form/
Specials/
Model/
view/
In the controller I add the line use Account\Forms\Specials\SpecialForm1
, then I call $special_form1 = new SpecialForm1("form_special1);
it but that gives me the errornot found
Does anyone know how I can do this please.
With a structure like the one proposed, Zend builds
namespace
each module's from the directory it containssrc
(at least in the traditional skeleton).If we simplify the schema to the class we want to instantiate, in this case the class
SpecialForm1
, it would look like this.The
namespace
classSpecialForm1
would be like this:And to instantiate it from the controller we can use it as follows: