Table per class doctrine2 中的继承未正确创建表

Table per class inheritance in doctrine2 not creating tables properly

我有这样的class继承

 /**
 * @ORM\Entity
 * @ORM\Table(name="persons")
 * @@ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="person_types", type="string")
 * @ORM\DiscriminatorMap({
 *                        "insuree" = "Insuree",
 *                        "third_party" = "ThirdParty"
 *                      })
 */
abstract class Person {


/**
 * @ORM\Entity
 * @ORM\Table(name="insurees")
 */
abstract class Insuree extends Person

/**
 * @ORM\Entity
 * @ORM\Table(name="third_parties")
 */
final class ThirdParty extends Insuree {

当我执行 schema:create 时,instad of doctrine 在 Person class 上创建了鉴别器列,它创建了 person table 以及属于它自己的字段,仅此而已,然后,使用人员 table 列和属于自己的列创建了被保险人 table,然后使用人员和被保险人 table 的列创建了 third_parties table s 和属于它自己的列。当我执行 EntityManager::flush() 时,third_parties table 中的所有列都被填充,而其他两个 table 都是空的。我错过了什么?我按照 doctrine 官方网站的文档,似乎我做对了。

@InheritanceType annotation 中有错别字:

@@ORM\InheritanceType("JOINED")

你有一个双“@”。

这会导致注释被忽略。

删除其中一个“@”。