@Jonathan, yes it always a bit "confusing" the hasOne (in Cake).. because a Task hasOne priority, no matter if this priority is shared .. but for cake it'a a belongsTo .. :-) Even after using for few months (years)... hasOne always make me think twice (actually I use it very rarely)..
On Jul 3, 9:56 pm, John David Anderson <[EMAIL PROTECTED]> wrote: > I always remember it like this: > > If a table contains a foreign key, it's like a little label that > another object has put on it... i.e. it belongsTo something else. > > hth/fwiw, > > John > > On Jul 3, 2008, at 1:38 PM, Jonathan Snook wrote: > > > > > A priority hasMany tasks. > > A task belongsTo a priority. > > > It's a little weird, I know because in English you'd normally say: > > > A task has a priority. > > A priority belongs to many tasks. > > > And belongsTo is used if: > > A priority has one task. > > A task has one priority. > > > At least, that's how I've considered it. (Although I'll gladly be > > corrected). > > > On Jul 3, 1:53 pm, jhicks <[EMAIL PROTECTED]> wrote: > >> OK, so I've got two tables: tasks and priorities. Many tasks can > >> share > >> the same priority. So is this a HABTM relationship? > > >> With HABTM, you usually have a join table but in my situation I don't > >> need one. I just have a foreign key in my tasks table (priority_id) > >> which points to the index of the priorities table. What do I do in > >> this situation? CakePHP is expecting a join table. > > >> Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
