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

Matt S Trout dbix-class at trout.me.uk
Mon Oct 15 20:22:53 GMT 2007


On Mon, Oct 15, 2007 at 09:27:18AM +0200, Tobias Kremer wrote:
> > 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.
> 
> Great and not so great. This means that whenever I add attributes (be it new
> columns or just new custom methods) to the proxied class I'll have to
> update the proxy array with these attributes, right? This is quite error
> prone IMHO. I need full access to _all_ methods through the proxy.
> Is there any way around this?

Why not pull the attribute list via $f_class->columns and ->relationships?

Doing it by hand seems illogical and idiotic to me.

> > 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 :)
> 
> Yeah, maybe nobody has a clue how to accomplish a more elegant solution in a
> sane way :) Maybe you can point us in the right direction ...

Have a look at how the many-many helper stuff works and start from there?

> Also, due to the fact that the DBIC wiki is offline for quite some time now,
> there's no documentation anywhere concerning this method of accessing
> attributes in a many-to-many link-table. Shouldn't this be in the Cookbook
> or somewhere else? If so, I could provide a doc patch for it because I was
> lucky enough to save the wiki page before it went off :)

Sure. The wiki was taken offline because it kept getting spammed and nobody
was bothering to repair it, plus we saw a lot more cookbook patches than wiki
edits so I assumed anything useful had already gone across. If there's anything
missing, by all means send it upstream as a POD patch.

-- 
      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