mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Allow creating fixture records without any columns by checking the fields exist first before doing a foreach() in YamlFixture::writeDataObject() (from r98055)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102592 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f22ee6939e
commit
91918ccfe1
@ -179,7 +179,7 @@ class YamlFixture extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Populate the dictionary with the ID
|
// Populate the dictionary with the ID
|
||||||
foreach($fields as $fieldName => $fieldVal) {
|
if($fields) foreach($fields as $fieldName => $fieldVal) {
|
||||||
if($obj->many_many($fieldName) || $obj->has_many($fieldName) || $obj->has_one($fieldName)) continue;
|
if($obj->many_many($fieldName) || $obj->has_many($fieldName) || $obj->has_one($fieldName)) continue;
|
||||||
$obj->$fieldName = $this->parseFixtureVal($fieldVal);
|
$obj->$fieldName = $this->parseFixtureVal($fieldVal);
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ class YamlFixture extends Object {
|
|||||||
$this->fixtureDictionary[$dataClass][$identifier] = $obj->ID;
|
$this->fixtureDictionary[$dataClass][$identifier] = $obj->ID;
|
||||||
|
|
||||||
// Populate all relations
|
// Populate all relations
|
||||||
foreach($fields as $fieldName => $fieldVal) {
|
if($fields) foreach($fields as $fieldName => $fieldVal) {
|
||||||
if($obj->many_many($fieldName) || $obj->has_many($fieldName)) {
|
if($obj->many_many($fieldName) || $obj->has_many($fieldName)) {
|
||||||
$parsedItems = array();
|
$parsedItems = array();
|
||||||
$items = preg_split('/ *, */',trim($fieldVal));
|
$items = preg_split('/ *, */',trim($fieldVal));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user