I’m using Doctrine 2 and single table inheritance, my topmost entity hierarchy is:
JS_File --> [one to many] --> JS_File_Version
And then my sub-class entity hierarchy is:
JS_Image (extends JS_File) --> [one to many] --> JS_Image_Version (extends JS_File_Version)
The inheritance mapping works perfectly for JS_File and JS_Image, and the association mapping works perfectly for JS_File –> JS_File_Version. But, when it comes to map the “versions” association on JS_Image I get:
'Property "versions" in "JS_Image" was already declared, but it must be declared only once'
I understand why this is, the association is being inherited from JS_File and I can’t overwrite it, but how do I achieve what I’m trying to do? Basically, with inheritance, how can I tell Doctrine to use a different targetEntity for the sub-classes association.
Looks like what I’m trying to do isn’t possible (having both JS_File and JS_Image as concrete entities). I’ve followed the advice of someone from the doctrine-user mailing list instead:
http://groups.google.com/group/doctrine-user/msg/243f355191d3a512