[html-formfu] defaults_from_model

Zbigniew Lukasiak zzbbyy at gmail.com
Tue Mar 11 08:34:23 GMT 2008


Hi,

Just some ideas on the API - not that I want it implemented right now
- but perhaps it can be useful at some next refactorisation effort.

The current calling convention is:

$form->model('DBIC')->default_values( $item )

Frankly I don't see much practical value in using multiple models per
form - if you need to edit two databases on one page then you can
always make two forms, but perhaps someone will use it sometime - but
if we really want to do that then the model should be called by it's
unique name not by it's type.

And if we stay with just one model then we could make it more backward
compatible by breaking it into two calls:

$form->model('DBIC');
$form->defaults_from_model( $item );

And the first call could go into the configuration.

I would not expose the fact that FormFu has models too much - because
it is easily confused with the Catalyst (or other MVC framework
models). I would rather keep it as some internal affair - and leave
the methods on the $form object.

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/



More information about the HTML-FormFu mailing list