where basically the Zend_Form just stores the meta data of the form and the form is actually handled by a viewhelper.
All this academic stuff does come at the price of complexity though...in the end of the day, we would like to just get our job done, and Zend_Form gives a good compromise for doing that.
On Wed, Jun 3, 2009 at 8:46 PM, Tomoaki Kosugi <kipspro@gmail.com> wrote:
Hi
This approach is just like Zend_Form with validators, model-data, and
decorators.
$form->addDecorator($decorator);
$form->render();
This approach is very very usuful for making a semantic view dynamically,
getting an advantage over the MVC designed with separate templating .
This ease concerns about making a widget or a sectionally view design.
And for keeping view scripts simply.
I think that It would be nice if Zend_Form_(*) be remade to
general-purpose classes.vary depending on the intended use.
Like a Zend_Element or Zend_Decorator.
I tried to design a model with an architecture just like Zend_Form .
First,I was stuck in a collision Zend_Form_Decorator_Abstract::setElement.
It allows only Zend_Form_Element or other classes.
Because Zend_Form is designed only to render form-elements.
Thus, I made a model what is based upon Zend_Form.It has a delegation
to Zend_Db_Table.
Besides, Zend_Form_Element is designed to represent a form element.
I made custom elements to match semantic model's elements.
thanks
--
Tomoaki Kosugi
id:noopable
2009/6/4 Ed Lazor <edlazor@internetarchitects.biz>:
> Anyone happen to have their models designed to "render" themselves?
> For example:
>
> $model->display();
>
> or
>
> $model->draw();
>
> This is more of a general OOP question, but I'd like to apply it as
> much to ZF as possible since that's where I'll be implementing it. I
> read how you're supposed to design your objects and assign them the
> responsibilities to manage themselves. The article (mentioned in my
> last thread) gave the example of having the model draw itself. It
> sounds neat, so I'd like to try it and I'm wondering how to approach
> it. I'm guessing the model would generate the data, send it to an
> adapter of some sort, the adapter would apply a template (or
> whatever), results would return to the model, which then returns the
> results to the originating code. Is that correct? Anyone know / have
> examples?
>
> Thanks,
>
> Ed
>
>
没有评论:
发表评论