[Dbix-class] has_one joining through another table

Steve Francia steve at takkle.com
Tue Jun 26 18:14:17 GMT 2007


In my database I have three tables user, picture and user_picture.
They are setup with many to many relationships and work great.

The user_picture table also has an extra field, owner (bit), which
designates the original uploader.

What I would like to have is a has_one relationship that joins picture
to user through the user_picture table where owner = 1.
so $video->owner would be the user object.

In that way it would work similarly to the many_to_many convenience
relationships.

Perhaps this goes beyond the scope of has_many and I would need to setup
a relationship through add_relationship?
Has anyone encountered this before. Any tips would be helpful?

-Steve

-- 
Steve Francia
Lead Developer
Takkle, Inc.
212.792.5859 (fax)
steve at takkle.com




More information about the Dbix-class mailing list