[CDBI] custom has_a accessors

Michael Reece mreece at vinq.com
Thu Jan 25 17:50:40 GMT 2007

has anyone hacked CDBI::Relationship::HasA or otherwise solved the  
challenge of custom accessor names for has_a relationships?

i am trying to solve the general case of my foreign key columns being  
named foo_id, and wanting to access $thing->foo instead of $thing- 
 >foo_id to get the object.

i've currently done it with some hacks involving AUTOLOAD so that  
$thing->foo maps to $thing->foo_id and $thing->foo_id maps to $thing- 
 >foo->id, but am looking for something more graceful.

More information about the ClassDBI mailing list