mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Writing record from yml before parsing relations in YamlFixture->saveIntoDatabase() to avoid missing lookups for reflexive relations on the same object
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64004 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
06d78ee993
commit
320c30ba5d
@ -130,6 +130,12 @@ class YamlFixture extends Object {
|
||||
foreach($fixtureContent as $dataClass => $items) {
|
||||
foreach($items as $identifier => $fields) {
|
||||
$obj = new $dataClass();
|
||||
$obj->write();
|
||||
|
||||
// Populate the dictionary with the ID
|
||||
// has to happen before relations in case a class is referring to itself
|
||||
$this->fixtureDictionary[$dataClass][$identifier] = $obj->ID;
|
||||
|
||||
foreach($fields as $fieldName => $fieldVal) {
|
||||
if($obj->many_many($fieldName) || $obj->has_many($fieldName)) {
|
||||
$parsedItems = array();
|
||||
@ -150,9 +156,6 @@ class YamlFixture extends Object {
|
||||
}
|
||||
}
|
||||
$obj->write();
|
||||
|
||||
// Populate the dictionary with the ID
|
||||
$this->fixtureDictionary[$dataClass][$identifier] = $obj->ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user