我想在我的项目单表继承中使用symfony2 / doctrine,但我找不到任何带有yaml配置的工作示例。在官方文档中,仅提供了注释配置。我找到了xml示例,但我想使用yaml配置。有人可以帮助并分享一些有效的代码吗?
答案 0 :(得分:12)
好的内置转换器可以挽救生命。
为了节省时间,这个继承的例子转换为yaml:
#file: Resources/config/doctrine/Person.orm.yml
Person:
type: entity
table: null
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
inheritanceType: SINGLE_TABLE
discriminatorColumn:
name: discr
type: string
length: 255
discriminatorMap:
person: Person
employee: Employee
lifecycleCallbacks: { }
#file: Resources/config/doctrine/Employee.orm.yml
Employee:
type: entity
table: null
lifecycleCallbacks: { }
答案 1 :(得分:1)
实体配置文件应根据reference放入src/Acme/StoreBundle/Resources/config/doctrine/<EntityName>.orm.yml
。