Wednesday, October 27, 2010

HABTM/Linking table structure question

Structure:

Projects
- project_id
- project_name

Contacts
- contact_id
- contact_name

Contacts_Projects
- project_id
- contact_id

When reading the Cookbook, in a HABTM setting, I should add an ID
field to the Contacts_Projects table. Wouldn't this field enable the
possibility of having duplicates?

For instance, with the ID added:

Contacts_Projects
- ID
- project_id
- contact_id

1,33,99
2,33,99

Or does the ID field only act as auto number, but the key is still
composed of project_id/contact_id?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: