Convert to array if JSON isn't one already.
This commit is contained in:
parent
e024bdba85
commit
4df5b6896c
@ -16,9 +16,12 @@ class FieldDefinition
|
|||||||
if (!file_exists($definitionFile)) {
|
if (!file_exists($definitionFile)) {
|
||||||
throw new \Exception('File ' . $definitionFile . ' not found!');
|
throw new \Exception('File ' . $definitionFile . ' not found!');
|
||||||
}
|
}
|
||||||
$fieldDataJson = file_get_contents($definitionFile);
|
$fieldDataJson = file_get_contents($definitionFile);
|
||||||
/** @var array */
|
$fieldData = json_decode($fieldDataJson, true);
|
||||||
$this->fieldData = json_decode($fieldDataJson, true);
|
if (!is_array($fieldData)) {
|
||||||
|
$fieldData = array($fieldData);
|
||||||
|
}
|
||||||
|
$this->fieldData = $fieldData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFieldData()
|
public function getFieldData()
|
||||||
|
Reference in New Issue
Block a user