ZF 2 - When to use Modules

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

ZF 2 - When to use Modules

Post by shiznatix »

I just today started taking a seriously look at ZF 2. I would like to re-write this one small and fairly simple website in ZF 2 but it seams that the documentation and examples just aren't really there yet.

So, my first question deals with Modules. In ZF 1.* I made each section of the website a different module. There is the default (user side) and the admin modules. Each module had all the controllers, view, layouts, etc that was needed for that specific section. The only real thing in common between the modules was the database and main configuration, which is fine for me.

Now, ZF 2 seams to go in a different direction that I am not sure of yet. As far as I have been able to gather, 1 module in ZF 2 is just 1 page (controller) with all files needed for it. This doesn't seam so great for me though as my "companies" page is 100% different on the client side and admin side.

So, really, how should I be using Modules in ZF 2 and how should I separate the different sections (user, admin) within the code structure?

P.S. If anyone has any good tutorials on how to migrate from ZF 1 to 2 I would be very interested in those links.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: ZF 2 - When to use Modules

Post by Christopher »

I think you are misunderstanding ZF2 modules. They are more like complete apps that previous modules. The Module.php file configures the module, but it can have all the same MVC files -- just reorganized a little.
(#10850)
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Re: ZF 2 - When to use Modules

Post by shiznatix »

Christopher wrote:I think you are misunderstanding ZF2 modules. They are more like complete apps that previous modules. The Module.php file configures the module, but it can have all the same MVC files -- just reorganized a little.
So would it make sense to have 1 module for the user side and 1 module for the admin side, like I have been doing or do I still not quite get it?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: ZF 2 - When to use Modules

Post by Christopher »

Yes. ZF2 modules are, for better or worse, a lot more complicated than ZF1 modules. You should be able to do the same thing you did before with ZF2. That is a fine division -- especially if you reuse the admin part on multiple sites.
(#10850)
Post Reply