20130425

Loading modules in Zend Framework 2 for the lazy (only for Development purposes)

When you are developing modules for ZF2, you have to add your model name manually to the application.config.php file:

If you want to "load" your module without doing this (use this only for development!!! not in production!!!) you can hack the application.config.php to construct the array with the modules in your filesystem.

This will read your modules directory and fill the configuration array with them. Just a quick hack!

When deploying to production just add your production modules in the original config array and its ready to work.

Update:
As Manuel Stosic pointed out in the ZF2 group in facebook, this is not a good approach if you you need to preserve loading order. This is intended to be use in your own modules while developing (i use this approach with a dev partner), if you are going to use zfcUser, etc... just put those modules in the original config array.

No hay comentarios.:

Publicar un comentario