title: Yii join tables on column other than PK
body: <p>I'm using the <a href="http://www.yiiframework.com/extension/imagesgallerymanager/" rel="nofollow">Gallery Manager</a> extension which has a Gallery model connected with a one-to-many relation to the GalleryPhotos model (gallery_photo.gallery_id FK to gallery.id).</p>
  
  <p>I have a Products model that I want to join to a Gallery model with a one-to-one relation.</p>
  
  <p>How would I define such a relation given that I don't want to modify the Gallery table (to add a FK).
  One option I thought about is adding a gallery_id field to my Products table that would point to Gallery->id but how would I define the relationships in my Products model file?</p>