I have comments and articles, both are elective.
So basically I have three objects, Article , Comment and Vote .
After some reading in the Single Table Inheritance reference manual in Doctrine2, it seems like this is what I need because my Vote stays the same over Article or Comment .
In the ORM view, this is how I see the Vote table:
id | resource_id | resource_type | weight |
I think resource_type should be a discriminator column, but I really don't understand how to implement this in my essence.
What I'm trying to do is to avoid the voting table for each of my objects, since the voting object remains the same for both, except for "resource_type", so I'm trying to find a way within Doctrine2 to be able to work with one Vote object .
Johnt
source share