How to convert an object leaving its id

There are several objects (Region, Country, City) that used STI (or even CTI). How can I convert a country into a city, leaving the old identifier?

+3
source share
1 answer

This is not supported in Doctrine 2 because custom casting objects are not supported by PHP.

With that said, Doctrine uses the discriminator column to determine what type of object is hydrating. If you change the value of the discriminator column in the database using SQL UPDATE, the type of the object will be changed the next time the object is loaded. This works for STIs, but CTI will be more complex.

+4

All Articles