How (if possible at all) do you change the entity type with Doctrine2, using it's Class Table Inheritance?
Let's say I have a Person
parent class type and two inherited types Employe
and Client
. My system allows to create a Person and specify it's type - that's fairly easy to implement - but I'd also like to be able to change the person from an Employe to a Client, while maintaining the Person
-level information (it's id and other associated records).
Is there a simple way to do this with Doctrine2?
I was looking for this behaviour yesterday also.
In the end, after speaking with people in #doctrine on freenode, I was told that it is not possible.
If you want to do this, then you have to go through this:
Employee
table for this inheritance.Likewise if you want to remove inheritance, you have to..
Employee
table. (Yes you have to delete it, just change the discrimator coumn is not sufficient). This might be 7 months late, but it is at least the correct answer for anything else looking to suport such a feature.