tags:

views:

68

answers:

2

Hi all,

I am new to Models structure in Cakephp.
A few weeks ago I came across a tutorial in which the author
got three tables in Database:

Table A: {ID, Description, IsActive}
Table B: {ID, TableA_ID, Description, CreationDate, ModifiedDate}
Table A_B: {ID, TableA_ID, TableB_ID}

The author of the tutorial said that the third table (Table A_B) is needed to
run in CakePHP.

I don't understand.
Is there any specific documentation in CakePHP that I can refer to?
I know there is a CookBook in Cakephp web site, but I couldn't find the
relevant infromation.

+1  A: 

I guess what you need is HABTM in the cookbook.

SpawnCxy
+3  A: 

"... the third table (Table A_B) is needed to run in CakePHP."

Table B already includes a foreign key TableA_id referencing table A, implying a belongsTo or "one-to-many" relationship. Table A_B implies a hasAndBelongsToMany or "many-to-many" relationship. It seems a bit nonsensical to have both. You would need a really specific reason for this. Unless the author mentions this reason, disregard his advice. :)

deceze