[html-formfu] HTML-FormFu-DBIC

Carl Franks fireartist at gmail.com
Wed Nov 7 09:33:23 GMT 2007


On 07/11/2007, Mario Minati <mario.minati at googlemail.com> wrote:
> On Wednesday 07 November 2007 10:14:49 Carl Franks wrote:
> > On 06/11/2007, Brian Cassidy <brian.cassidy at nald.ca> wrote:
> > > Carl Franks wrote:
> > > > I spoke with zby a while ago about HTML-FormFu-DBIC, and this is what
> > > > was agreed:
> > > > At the moment, fill_formfu_values() and populate_from_formfu() are
> > > > copied in both DBIx-Class-HTML-FormFu and HTML-FormFu-DBIC.
> > > > So what we'll do is have them only in HTML-FormFu-DBIC as exportable
> > > > functions, and have DBIx-Class-HTML-FormFu import them.
> > >
> > > So, what exactly is the purpose of DBIx::Class::HTML::FormFu, or more
> > > precisely the dist "DBIx-Class-HTML-FormFu", other than a little bit of
> > > syntactic sugar for __PACKAGE__->load_components(...) ?
> >
> > Good point.
> > Looking at DBIx-Class-HTML-FormFu, it doesn't even inherit from
> > DBIx-Class, so I guess we could simply have the functions exportable
> > from there, and forget about having a separate HTML-FormFu-DBIC
> > module.
> >
> > I think, originally, zby wanted HTML-FormFu-DBIC to be a sub-class of
> > HTML-FormFu, but I didn't like that, because it means you have to
> > configure things like Catalyst-Controller-HTML-FormFu to know which
> > class to use.
> >
> > I'm starting to wonder whether they should simply be core HTML-FormFu
> > methods?
> >
> >     $form->values_from_dbic( $row );
> >     $form->update_dbic( $row );
> >
> > It should even be possible to make the methods agnostic to whether
> > they're given a form or a block, so instead of using the current
> > 'nested_base' argument:
> >
> >     $form->update_dbic( $row, { nested_base => 'foo' } );
> >
> > You could do:
> >
> >     $fieldset->update_dbic( $row );
> >
>
> The idea of doing an update from a fieldset is very elegant.
>
> You could even do it as a one liner:
> $form->get_all_element( { nested_base => 'foo' } )->update_dbic(
> $c->model( 'Some::Model::Name' )->new( {} ) );
>
> I would work with create_related and so on.
>
> Could the update_dbic return the row object, so that it is chainable?

Yup, populate_from_formfu() already does return the $row

> And could we keep the current DBIx-Class-HTML-FormFu for a while as a stub, to
> give some time to addopt our code ;-)

I think we'd simply document it as deprecated, and leave it on cpan,
at least for a good while.
...that's if we go ahead with this ;)

Carl



More information about the HTML-FormFu mailing list