【发布时间】:2016-07-28 15:59:57
【问题描述】:
我想做的是从映射的超类扩展单个表继承类,但是当我尝试更新方案时出现以下错误:
[Doctrine\DBAL\Schema\SchemaException]
名称为“uniq_efe84ad134ecb4e6”的索引已在表“article_article”上定义。
我的层次结构:
内容(mappedSuperClass)
类:
abstract class Content
{
protected $id;
public function getId()
{
return $this->id;
}
}
class Article extends Content
{
}
class MyArticle extends Article
{
}
映射:
Content:
type: mappedSuperclass
id:
id:
type: integer
id: true
generator:
strategy: AUTO
Article:
type: entity
table: article_article
inheritanceType: SINGLE_TABLE
discriminatorColumn:
name: discr
type: string
discriminatorMap:
article: Article
my_article: MyArticle
MyArticle:
type: entity
这里有什么问题?
【问题讨论】:
标签: symfony inheritance doctrine