This is clearly explained in this article:
http://devzone.zend.com/article/3350-Action-Helpers-in-Zend-Framework
On 15/08/2008 17:14, "Luke Crouch" <luke.crouch@gmail.com> wrote:
I think you have 3 models - Events, Persons, Subscriptions.
I think each model needs its own controller to handle the basic operations for manipulating the model objects. if you're worried about duplication of code, make a parent controller class from which EventController, PersonController, and SubscriptionController extend.
You will still have 3 separate controllers, but each will be minimal and be re-using code rather than duplicating code.
-L
On Fri, Aug 15, 2008 at 8:20 AM, Michael Tramontano <mtramontano@efashionsolutions.com> wrote:
Jigal,
Generally I make a controller for every "section" of my web app. Since I keep business logic in the model layer, and the controllers can use the same zend_form's, I typically have little to no "overlap" (I'm assuming you mean repeated logic/code). While I have several controllers, I have only 1 controller layer. Perhaps this is what you've interpreted as ">If you read throughout the web about mvc. you see that an application has generally speaking one controller (which on it's turn can have many subcontrollers).".
You might need to revisit what logic and code you've put into your controllers and see if you can push any repeated code out to a shared model layer. If you have to, you can wrap this "pushed logic" in a new model class(es).
-mike tramontano
From: Jigal sanders [mailto:jigalroecha@gmail.com]
Sent: Thursday, August 14, 2008 4:50 PM
To: Zend Framework MVC
Subject: [fw-mvc] [ZF] Model arcitecture
Hello Everyone,
I have more kind of architectural question which has a lot to do with the zend MVC. My problem is as follows. Lets consider a webapplication which does something with users , events and subscriptions. The idea is that users can subscribe for events and admin's can manage the subscriptions. So far so good.
Now it's like this. The Zend framework is very clear about controller's and views. The problem is about the model on which Zend is (according to my humble opinion) not so clear. And thus I have questions about.
If you read throughout the web about mvc. you see that an application has generally speaking one controller (which on it's turn can have many subcontrollers). I have splict my application up in generally 3 main controllers (eventController, personController and Subscribtion controller). And today I was thingking about it and came to the conclusion that this is not very handy, since you always have overlapiing stuff. So I thought of 2 possible solutions.
SOLUTION 1: Keep 3 controllers wich are only connecting to the model through a (model) controller. One of the disadvantages is that I will keep struggeling with the controlles for overlapping Items.
SOLUTION 2: Merge the 3 controllers to one controller and use it to connect to the model. This will keep the most overview but one large controller.
So my question to you is what do you think about this analysis? Which solution would you choose or is ther a third , better solution?
Thanks in advance.
J. Sanders
没有评论:
发表评论