hi, basically i have following models in CakePHP:
User(id, username) Photo(id, user_id, path)
i have set up following relation: User hasMany Photo.
now, on one screen, i would like to list users, and show random photo next to each user. i tried setting up following relation:
User hasOne SamplePhoto (where SamplePhoto is just Photo model)
but when user has two photos for instance, he is listed twice on the list.
basically my question is: can you reduce hasMany relation to hasOne, without adding any fields to table schema presented above? i would like to tell cake - find first record in Photo table which matches witch certain user_id.