问题描述
有一些实体(区域,国家,城市)使用(甚至CTI)。
There are some entities (Region, Country, City) wich used STI (or even CTI). How it possible convert Country to City leaving old id?
推荐答案
Doctrine 2中不支持此功能,因为类型转换用户对象不是由PHP支持。
This is not supported in Doctrine 2 because type casting user objects is not supported by PHP.
根据这一点,Doctrine使用discriminator列来确定什么类型的对象可以合并。如果使用SQL UPDATE更改数据库中的鉴别符列的值,则在下次加载对象时对象类型将被更改。这对STI是有效的,但是CTI会更复杂。
With that said, Doctrine uses the discriminator column to determine what type of object to hydrate. If you change the value of the discriminator column in the database with a SQL UPDATE, the object type will be changed the next time the object is loaded. This works for STI, but CTI would be more complicated.
这篇关于如何转换实体离开id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!