我有两个映射的超类AbstractItem
和AbstractTemplate
,具有多对一的单向关联:
Me\Core\Entity\AbstractItem:
type: mappedSuperclass
id:
id:
type: integer
generator: { strategy: AUTO }
manyToOne:
template:
targetEntity: AbstractTemplate
Me\Core\Entity\AbstractTemplate:
type: mappedSuperclass
id:
id:
type: integer
generator: { strategy: AUTO }
实际的类Section
并Template
扩展它们的抽象对应物。当我转储 SQL ( php app/console doctrine:schema:update --dump-sql --complete
) 时,我得到:
CREATE TABLE section (
id INT AUTO_INCREMENT NOT NULL,
position SMALLINT NOT NULL,
template_id INT DEFAULT NULL,
INDEX IDX_2D737AEF5DA0FB8 (template_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE template (
id INT AUTO_INCREMENT NOT NULL,
path VARCHAR(255) NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
...并且没有创建外键section.template_id
。template.id
任何想法?我正在使用 Doctrine 2.3.*。