To, it sounds like: Person belongsTo Country
I'd use a belongsTo relationship in the Person model. And if you need to do Country->People lookups, put a reverse hasMany in the country model. I wrote a bit on understanding the practical differences between relationships here: http://bennerweb.com/node/16 Nick wrote: > Hi > > We're exploring CakePHP, and I'm stuck on how to describe the > following model relationship. It should be trivial and I'm sure that > I'm missing something, but precisely what eludes me. Can anyone help? > > Let's say that we have a model 'Person', and one of the attributes for > Person is "country". The value of country is the primary key into a > table of Countries. $hasOne can express that Person should join on > Countries, but the join is made against Person.id, and I cannot find a > way to express that the field in Person to use for the join is > country. > > Checking the archives, floepi posted a tweak back in January to add an > associatedKey attribute for $hasOne to express this notion, but I > wondered whether something like this is now standard in 1.2. > > Cheers > Nick > > > > > -- Joshua Benner http://bennerweb.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
