[Catalyst] Instant CRUD with DBIC::Schema

Peter Karman peter at peknet.com
Mon Mar 10 15:07:54 GMT 2008



On 03/10/2008 07:42 AM, Zbigniew Lukasiak wrote:
> And another thought - in FormFu we have an interface to DBIC it's
> called HTML::FormFu::Model::DBIC.  From reading the code it looks that
> in CatalystX::CRUD::Model::DBIC you have also code for interfacing the
> form library with DBIC - does that mean that HTML::FormFu::Model::DBIC
> would not fit for CatalystX::CRUD?
> 

There's nothing about forms in CatalystX::CRUD::Model::DBIC. There is some rudimentary query
creation based on CatalystX::CRUD::Model::Utils, but that is convenience for getting at
$c->req->params and corralling them based on the valid fields defined by the ::Controller.

A quick read of the HTML::FormFu::Model::DBIC docs suggests to me that the class implements
something analogous to RHTMLO's object_from_form() and init_with_object() methods. If that's the
case, then no, there's nothing in CatalystX::CRUD that would prevent you from using
HTML::FormFu::Model::DBIC to implement better integration with a CX::CRUD::Controller::FormFu. That
might actually be the path of least resistance. You'd want to use it to define init_form and
init_object method names to be called on the form object. Look at
http://search.cpan.org/~karman/CatalystX-CRUD-0.25/lib/CatalystX/CRUD/Controller.pm to see how
init_form and init_object are used there.

However, a big NOTE here: if you (or anyone else reading this) go down the path of a
CX::CRUD::Controller::FormFu make sure to make it Model agnostic. That is, it could be used with
DBIC or RDBO or whatever. That's the whole point of CatalystX::CRUD. It would appear that
HTML::FormFu::Model::* is a placeholder for that same idea wrt FormFu.

-- 
Peter Karman  .  peter at peknet.com  .  http://peknet.com/




More information about the Catalyst mailing list