[Dbix-class] Best practice for multi-related table
Silvio Almeida
scvalmei at graaph.arq.br
Mon May 12 05:41:07 BST 2008
Hi, I'm new to the list and ask you for design advice. I'm working on a
Catalyst project, trying to preserve old code if possible, so this is my
idea:
What I call "multi-related table" is something like having a table Href
that could be addressed by different tables:
Text->has_many(links, Href);
Bookmark->has_many(links, Href);
Author->has_one(homepage, Href);
I tried different geometries but it seem to be impossible to succesfully
create all the inverse relashionships simultaneously:
Href->belongs_to(Text);
Href->belongs_to(Bookmark);
Href->belongs_to(Author);
Maybe I'm looking for something like might_belong_to, which doesn't
exists, maybe it's just bad design. As a matter of fact, Href knows
nothing about which objects its foreign keys come from, so probably
those inverse relationships are be pointless anyway. Is it ok to go on
without'em?
Thanks,
Silvio Almeida
More information about the DBIx-Class
mailing list