Re: User and Friend model HasAndBelongsToMany relationship

2007-05-18 Thread Victor
AD and jyrgen: thanks for responding. AD: I really appreciate that you answered each of my questions. Very helpful! God Bless You! You clarified things for me. I now see that I don't really need Friend model. I just need a join table (let's just call it friends). I have tried it. It works beauti

Re: User and Friend model HasAndBelongsToMany relationship

2007-05-17 Thread AD7six
Hi Victor, Hope I can clarify a couple of things for you. On 17 mayo, 20:47, Victor <[EMAIL PROTECTED]> wrote: > I am trying to define the right model and relationship for User and > Friend. Here are my tables > > CREATE TABLE users { > id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, > name VARCHAR

Re: User and Friend model HasAndBelongsToMany relationship

2007-05-17 Thread jyrgen
can a model be associated to itself in cake ? if so, then you would need a user-user table like this: CREATE TABLE user_user { usera_id INT UNSIGNED, userb_id INT UNSIGNED PRIMARY KEY(usera_id, userb_id) } anyways, this is a special case to my opinion which cannot be baked. i might be wrong, but

Re: User and Friend model HasAndBelongsToMany relationship

2007-05-17 Thread Victor
Sliv, Thanks for responding. Interestingly, I just saw the tonymarston article. It is database design issue. But I think that it is more how to implement in CakePHP. There are some CakePHP code fragments out there. But I didn't a complete description yet. On May 17, 6:10 pm, Sliv <[EMAIL PROTEC

Re: User and Friend model HasAndBelongsToMany relationship

2007-05-17 Thread Sliv
I think that's maybe a db design issue more than a cake one and it really depends on what you want to accomplish with your data. I'd recommend doing some reading on the concepts of db normalization and data models: http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html http://w

User and Friend model HasAndBelongsToMany relationship

2007-05-17 Thread Victor
I am trying to define the right model and relationship for User and Friend. Here are my tables CREATE TABLE users { id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR (20) } CREATE TABLE friends { user_id INT UNSIGNED, friend_id INT UNSIGNED PRIMARY KEY(user_id, friend_id) } The next thin