views:

64

answers:

1

Hello,

I have three tables: note, user and tag. Following is the diagram of the relationship between those tables:

alt text

User can have many Notes and Tags, Note can have many Users and Tags, Tag can have many Users and many Notes. I have no problem setting many-to-many relationship between two tables, but can't manage to relate three tables. How can I describe this relationship in Doctrine?

A: 

You should make NoteUserTag its own Record/Entity with an additional surrogate ID:

note_user_tag_id
note_id
user_id
tag_id

This is probably the best to handle this situation.

beberlei