[Catalyst] Re: Adding relationships to loaded CDBI models
andy at hybridized.org
Mon Jun 20 01:08:39 CEST 2005
James Tolley wrote:
>>You could also change your tables to InnoDB and define foreign keys.
>>Then use the newest Class::DBI::Loader (only in trunk at the moment) and
>>it'll load them all for you.
> Thanks for the link. I'm wondering, though, about the "experimental" nature
> of the code, and the fact that it's not tested. Also, unless I missed
> something, it doesn't handle might_have or many-to-many mapping
> relationships. Are there plans to handle these issues? I'd consider writing
> the test code if no one else is planning to go it.
It's been tested insofar as it read a 38-table database of mine and
loaded all the foreign key relationships. :) I've since switched to
Class::DBI::Sweet and manually defined model classes as Loader isn't
really flexible enough for my app.
I'm not sure it's possible to figure out might_have and many-to-many
relationships based only on the foreign key information. I think those
are best defined manually to make sure it's what people want.
More information about the Catalyst