How to specify null foreign key in symfony doctrine fixture
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.
Omitting the foreign key row entirely worked:
Device:
Device_1:
name: 'My device'
精彩评论