I have two models, Content and Score. The Score model has a reference to a User (user_id) the Content model (content_id). Therefore, there can be many Scores associated with Content. So far, this is sounding like a cut-and-dry Content -> hasMany -> Score association, right?
Now, when I retrieve Contents, I only want the Score associated with a particular user; namely, the currently logged-in user. Ideally, I would want a hasOne relationship based on the user_id of the user that is logged in. However, the only way to find out that user_id is from one of my controllers, and you can't use controller logic in a Model. These are the following solutions I have come up with: 1) Create a hasMany association in Content and pass user_id in the parameters of all of my find(...) function calls 2) Create a hasMany association in Content, make the Content use the Containable behavior, and call Content->Contain('Score.user_id = $user_id') 3) Use bindModel(...) to add the association to the Content model in the controllers that use it Is there a better way I should be going about this? Thanks, Dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---