gre*_*emo 7 yaml doctrine symfony doctrine-orm
如何使用YAML为多对一关系"region" 设置外键的名称(编辑:不是属性本身的名称)?
SWA\TestBundle\Entity\Province:
type: entity
table: province
uniqueConstraints:
UNIQUE_PROVINCE_CODE:
columns: code
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
code:
type: integer
name:
type: string
length: 255
short_name:
type: string
length: 2
manyToOne:
region:
targetEntity: Region
inversedBy: provinces
Run Code Online (Sandbox Code Playgroud)
Jak*_*las 11
查看AbstractPlatform类中的getCreateConstraintSQL方法,以查看如何选择外键的名称(第1088行).
它直接取自约束名称.影响约束名称将影响外键名称.
作为一种解决方法,您可以删除约束并在学说迁移中使用新名称重新创建约束.
| 归档时间: |
|
| 查看次数: |
4406 次 |
| 最近记录: |