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)) {
|
||||
throw new \Exception('File ' . $definitionFile . ' not found!');
|
||||
}
|
||||
$fieldDataJson = file_get_contents($definitionFile);
|
||||
/** @var array */
|
||||
$this->fieldData = json_decode($fieldDataJson, true);
|
||||
$fieldDataJson = file_get_contents($definitionFile);
|
||||
$fieldData = json_decode($fieldDataJson, true);
|
||||
if (!is_array($fieldData)) {
|
||||
$fieldData = array($fieldData);
|
||||
}
|
||||
$this->fieldData = $fieldData;
|
||||
}
|
||||
|
||||
public function getFieldData()
|
||||
|
Reference in New Issue
Block a user