如何在 symfony 原则固定装置中指定空外键
这是一个 Doctrine 架构:
Device:
columns:
name: { type: string(60), }
os_version_id: { type: int(11), notnull: false }
relations:
OsVersion:
foreignAlias: Devices
OsVersion:
columns:
version: { type: string(60), fixed: false, notnull: true }
这是一个固定装置:
OSV_ABCD:
version: ABCD
OSV_DEFG:
version: DEFG
Device:
Device_1:
name: 'My device'
OsVersion: null
加载此固定装置时,我得到以下信息:
Invalid row key specified: (os_version) , referred to in (device) Device_1
如果我将 OsVersion: null
更改为 OsVersion: OSV_ABCD
,则加载不会出现问题。
Here is a Doctrine schema:
Device:
columns:
name: { type: string(60), }
os_version_id: { type: int(11), notnull: false }
relations:
OsVersion:
foreignAlias: Devices
OsVersion:
columns:
version: { type: string(60), fixed: false, notnull: true }
Here is a fixture:
OSV_ABCD:
version: ABCD
OSV_DEFG:
version: DEFG
Device:
Device_1:
name: 'My device'
OsVersion: null
When loading this fixture I get this:
Invalid row key specified: (os_version) , referred to in (device) Device_1
If I change OsVersion: null
to OsVersion: OSV_ABCD
it loads without problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
完全省略外键行:
Omitting the foreign key row entirely worked: