Z
Z
Zhenya T2014-10-08 19:25:11
symfony
Zhenya T, 2014-10-08 19:25:11

Composite key in Doctrine?

There is such a problem:
The user can comment on various kinds of entities (for example: a house, a room, a cat, anything)
There are the following entities with properties:
Dialog - id, x_id (id of what we are commenting on), dialog_type_id
DialogType - id
Comment - dialog_id, text
Entity-of-what-we-are-commenting - id
That is how things are: we choose what we are going to comment on. For example a cat. The cat has an id (=1) and the cat's comment type is 5. If we commented on a dog, we would have a dialogue type of 6 and the dog's own id. All this is done so as not to create a field in the dialog table for each commented entity (it would be dog_id, cat_id, home_id and 500 more fields)
The essence of the problem: how to "map" an entity so that the entity Cat has a GetDialog method?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sali_cat, 2014-10-08
@Sali_cat

Simple tree in db.
+ simple mysql queries.
Search on the topic "multilevel menu in php and mysql"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question