2008年9月23日星期二

Re: [fw-mvc] Zend_Form Quick start and architecture suggestions

Thanks, Matthew!
I think as a first approach, I'm going to use your suggestion using it with the models and an accessor to my forms.
Let's try! ;)

On Tue, Sep 23, 2008 at 7:21 PM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- Ramses Paiva <ramses@sourcebits.com> wrote
(on Tuesday, 23 September 2008, 04:18 PM +0530):
> I've been working for some time in a basic architecture and I'd like to start
> implementing Zend Form. Now I'm wondering where to put it in my current
> architecture?
> Is it a model extension and I should keep it inside my model layer?
> Is it an independent component and I should keep it in its own layer?
> If so, how do I handle it? My controllers should handle my form objects?
> Should I implement a form factory in my base controller, just as I'm doing with
> my models?

I've gone both ways, actually.

If you look at the QuickStart, we have the sample form as a separate
class under application/forms/. We then populate, validate, and assign
to the view from the controller.

In the pastebin demo I did for the Dojo webinar, I attached the form to
the model, and put it in models/Form/; the model then had an accessor
for retrieving the form, and used the form internally for validating
data passed to the model.

Both are valid approaches; use the one that suits your design needs.

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/


没有评论: