The first question is more of a SQL table design question than DBIC,
but it's at least related.
If I want a "might_have" relationship ( one-to-zero/one-to-one only),
how do I specify this in the table description? Or do you just
always do this like a one-to-many linking table, and enforce no > 1
row programatically or via DB trigger.
In a DBIC/Schema sense - my DBIx::Class::Schema::Loader reads the
linking table structure and sets up a ->has_many relationship.
Do I just override this with with a ->might_have or ->has_one
relationship (depending if you want outer or inner joins)?
Second question, more DBIC related - what is a good pragma for
getting out a single object when your DB specifies a one-to-many.
I find myself often constructing stuff like $myObjectIwant =
$resultSetICobbledTogether->next; (or ->first) just because I *know*
that there should be exactly 1 "row" in the result set (sometimes I
am using a search_related('belongs_to_rel').
Something like a find_related method (search_related but you specify
only PK)
Thanks,
Ben
--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO
Consortium
Stanford University ** [EMAIL PROTECTED]
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]