[Dbix-class] many-to-many with attributes (again)

Matt S Trout dbix-class at trout.me.uk
Fri Oct 12 18:41:07 GMT 2007


On Fri, Oct 12, 2007 at 01:39:42PM +0200, Tobias Kremer wrote:
> Quoting Tobias Kremer <list at funkreich.de>:
> 
> > Is the approach described in the (now offline) DBIC wiki still the way to go
> > if you want to access attributes stored in the table linking two other tables
> > in a many-to-many relationship?
> > I'm just asking to make sure that I'm not missing a recently introduced
> > feature or discovered technique which might make this stuff easier. I find
> > myself using additional attributes in the link table quite often which is not
> > unusual IMHO.
> 
> Still no answers - does that mean there's no other way of doing this? I find the
> described technique in the DBIC wiki quite cumbersome considering how often
> it is necessary to have additional attributes in the link table of a
> many-to-many
> relationship. Matt? Help! :-)

The many-many helper will provide add_to_mm_name and similar methods that
can take two hashrefs so you can provide far side and link attributes
simultaneously - but for retrieval of the attributes the proxy trick is still
the way to go.

If you find it cumbersome, automate it and send a patch, I've suggested this
to the last half dozen people complaining about this and so far not a single
one has found it's -that- cumbersome after all :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list