Saturday, 15 March 2014

zend framework2 - ZF2 autoloading custom controller -



zend framework2 - ZF2 autoloading custom controller -

i've created simple application in zf2. @ point decided create new set of functionalities created new folder way:

module application src application controller indexcontroller.php issue controller foocontroller.php

indexcontroller has namespace application\controller , actions working fine when seek run action foocontroller (namespace issue\controller) throws class 'issue\controller\foocontroller'. of course of study i've set routes , controllers in configuration (without it throwing 404 anyway).

the problem lies in fact folder name in src should correspond folder name of module. think related autoloading namespace magic in zf2.

so @demo suggests need this:

module application src application controller indexcontroller.php issue src issue controller foocontroller.php

or this:

module application src application controller indexcontroller.php foocontroller.php

read more on topic here @ question on stackoverflow

edit

read more on correctly setting module, autoloading through autoloaderconfig in module.php , psr-0 naming conventions here in zf2 user-guid

zend-framework2 php-5.3 autoload

No comments:

Post a Comment