【发布时间】:2018-04-23 10:18:11
【问题描述】:
当我执行 'doctrine:migrations:diff' 时,Symfony 不会“导出”字段长度,而是输入 '255' 并且 'doctrine:migrations:migrate' 不起作用。
我的两个实体 ORM 定义:
App\Resources\Domain\Stage:
type: entity
fields:
id:
type: stage_id
id: true
length: 36
name:
type: string
manyToOne:
educationalAreaId:
targetEntity: EducationalArea
joinColumn:
name: educationalAreaId
referencedColumnName: id
App\Resources\Domain\EducationalArea:
type: entity
fields:
id:
type: educational_area_id
id: true
length: 36
name:
type: string
我尝试在 manyToOne 定义中设置“长度”属性,但没有成功。
(我在 Ids 中使用字符串类型,因为我生成 UUID)
【问题讨论】:
-
我不熟悉实体的 yaml 定义,但看起来
types 的id是错误的。应该是string。您的types 值看起来像列名,因此您应该为此使用column: stage_id。要生成 UUID,您可以使用generator: { strategy: UUID }。 -
@PavelAlazankin 这些类型是其他实体。另一方面,我在提供的链接中没有找到任何解决方案。还是谢谢。
标签: php symfony doctrine-orm