Open nebucaz opened 8 years ago
The issue is that $obj = $blueprint->createObject($identifier, $data, $this->fixtures); actually writes the new object. This cant happen if the original being updated a unique index, such as Email with members. Unfortunately FixtureBlueprint is a core class.
Can confirm, this is effecting any record with a unique index value duplicated by populate data.
I was expecting the record data to merge without conflicts.
I hit this problem as well so I tried the example from the ReadMe:
SilverStripe\Security\Member:
admin:
ID: 1
Email: "admin@example.com"
PopulateMergeMatch:
- 'ID'
- 'Email'
It doesn't throw the same error but it also doesn't create a member. There is no Member with an ID of 1 or an email of admin@example.com.
I also get a [Notice] Undefined index: MyRelationID
when trying to use a has_one in PopulateMergeMatch
.
I expected to be able to update/merge existing records using PopulateMergeMatch as described in the documentation based. I've written a simple example like follows:
_config/config.yml
I expected the Populate task to merge with the existing record on consecutive runs of the populate task but it throws a validation error:
I've posted the sample-project here https://github.com/nebucaz/sspopulate