I am trying to create many many polymorphic relationships with Doctrine2 in Symfony2.
I would like one entity to be dynamically associated with multiplet objects.
I want to get the following diagram:
======
- video
- id - integer
- name - string
======
- tags
- id - integer
- name - string
======
- taggables
- tag_id - integer
- taggable_id - integer
- taggable_type - string
In the taggables object:
- tag_id is an associated tag
- taggable_id is the post id
- taggable_type - type of the associated object, that is, "Messages"
And I would like it to be the same with the "video", where:
- tag_id represents the identifier of the associated tag
- taggable_id is the identifier of the associated videos
- taggable_type - name of the associated object, i.e. "Video"
And all this without duplication of the table.
I tested several solutions, but I never got this result: /
Thank you in advance for your help.
source share