I have a project and I am trying to figure out the best way to associate my
models and how to structure them. In particular, I have something like a
polymorphic association situation.
I want to have a table of transactions, that list the transfers of money
from one user to another. The
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
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.
@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,