ZF2 Module / Application setup

For programming and general questions on Zend Framework

ZF2 Module / Application setup

Postby shiznatix on Fri Oct 12, 2012 3:30 pm

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.
shiznatix
 
Posts: 2
Joined: Fri Oct 12, 2012 3:30 pm

Re: ZF2 Module / Application setup

Postby shiznatix on Mon Oct 15, 2012 3:29 pm

*bump* any suggestions?
shiznatix
 
Posts: 2
Joined: Fri Oct 12, 2012 3:30 pm

Re: ZF2 Module / Application setup

Postby brown12 on Thu Oct 25, 2012 8:14 am

I'm a new user to Zend Studio and Zend Server and would like to make full use of the IDE capabilities of Studio to develop applications to be hosted on Apache with Zend Server. I would also want to make use of the new Framework 2.0 preferably - from what I could find googling, I need to add a .jar inside of Studio. The problem is just that its not available, even for 1.12! It would be fantastic if I could get it to run with full functionality, i.e. with the wizards to create a new project, new controllers, and all the other functionality.
brown
brown12
 
Posts: 1
Joined: Thu Oct 25, 2012 8:12 am

Re: ZF2 Module / Application setup

Postby gknitz on Sun Dec 16, 2012 7:57 pm

I am struggling with the same issues you are.
I am new to Zend but I have used other frameworks before even writing a small custom one.
I am porting an application from a custom framework to ZF2 which is constantly begging the question, why should I rewrite of the code if I'm not sure of a new solid structure.

There appears to be a lack of knowledge at least in the forums which makes it difficult to identify a general conscience on Best Practices. What I would like to see is someone create a very large multi-application that is all inclusive for the community to use as a bible. I have searched the web several times to find an answer only to see different approaches to the same problem many that may be bad practices in the future.

Let me know if you find a example of a large multi-application?
gknitz
 
Posts: 3
Joined: Wed Dec 12, 2012 11:26 pm


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 3 guests