[Catalyst] CatalystX::CRUD::Controller::RHTMLO: related database tables and nested forms

Peter Karman peter at peknet.com
Wed Jan 13 22:38:31 GMT 2010

John Siracusa wrote on 01/13/2010 10:30 AM:
> On Wed, Jan 13, 2010 at 10:33 AM, Adam Mackler <nabble at mackler.org> wrote:
>> First, his solution won't work with CatalystX::CRUD.  He has his
>> method called "person_from_form" that returns a Rose::DB::Object that
>> was created from the Rose::HTML::Form, and that DB object contains the
>> references to the related objects created from the related, nested
>> forms.  That's just what I want!  The problem is that his
>> person_from_form() method takes no arguments (besides the caller),
>> whereas I am using CatalystX::CRUD::Controller::RHTMLO, which calls
>> person_to_form() and expects to be able to pass to a it Person object
>> in order to update that object.  So his solution, which doessn't do
>> such updating, does't work with CatalystX::CRUD::Controller::RHTMLO.
> Ignoring Catalyst for a moment, here are some general patterns for
> CRUD with RHTMLO (error handling omitted):


fwiw, the CXC RHTMLO code implements all those general patterns.

> In all cases, the $object could be a tree of related objects.  In
> those cases, the load() calls to get an existing $object should use
> the load(with => ...) form (or perhaps a Manager call) to get a fully
> populated tree of objects.

yes, I use load(with => ...) in my own CXC-based apps.

> Pass a fully populated object tree to init_with_db_object() and it'll
> do this for you by matching up relationship/fk names with sub-form
> names.  Step through the code to see how it works, and how you could
> manually do the same thing.

yes. I think CXC can handle all these things. Again it is just thin
glue. I think the OP's obstacles are that CXC::YUI's View doesn't
present subforms at all.

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

More information about the Catalyst mailing list