[Dbix-class] Bidirectional many-to-many on a single table?
dbix at alexpeters.net
Tue Mar 25 08:55:57 GMT 2008
I'm struggling to convey a many-to-many relationship on the
same table with DBIx::Class. I've read over all of the
relevant documentation on CPAN and I've read past posts to this
list that seemed closely relevant by subject.
I have a database table called CriterionConflict with two
columns, criterionA and criterionB. This table intends to
document instances of Criterion records that cannot coexist.
The conflicts are bidirectional; there is no meaning to the
ordering of a pair of IDs in a CriterionConflict record.
I think a 'conflicts' accessor/mutator method in the Criterion
ResultSource class would be ideal, but I don't know how I might
go about this. For the accessor side of things I imagine I'd
need to construct a ResultSet searching across both columns;
for the mutator I'd probably start out with something similar.
I'm also unsure as to whether I need a CriterionConflict
ResultSet class, since I can't see any value to making this
How lost am I? ;)
If anyone could provide some example relationship code to
achieve this (or any other assistance), I'll gladly accept it.
 many to many self join?
Many To Many on the same table trouble
More information about the DBIx-Class