This is a re-post from zend-framework-community.634137.n4.nabble.com
I am trying to get myself into ZF2 but the whole idea of Modules still seams to elude me.
I have a admin section that is under its own domain (admin.example.com) and then I have a users section under www.example.com
. In ZF1, I have always put each one in its own Module - so that I have a "admin" module with its own models, controllers, etc (same for the users module).
Now in ZF2, it seams this idea has changed a bit and I am unsure of what would be the best way to go about it. The admin section isn't so much a CMS as it is a database data manager, but it still has many sections and the most complex stuff there. The users section just bring all the appropriate data together and displays it in a pretty layout.
So, what would be the best way to structure my code? My ideas so far have been:
1) Create a separate Application for each section and only share the Zend library between them
2) Each section gets its own Module, the same way as I was doing with ZF1
3) Split things up into different Modules that are related. For example making a Companies module that has the controller for the admin section as well as the controller for the users section.
#1 seams a bit...odd. Most of the configuration is the same for these sections so it seams strange to do it that way.
#2 seams to make the most sense to me but I don't think this is the way modules were meant to be used in ZF2
#3 doesn't seam to make a lot of sense for me. How do I control access to the different controllers in each module, why am I loading the admin module when I just want the users module, etc etc. Although, from what I have been reading, this seams to be the way it was intended to be used I just dont see it as a good idea.
If anyone can give me some advice I would be greatly appreciative.