|
|
|
|
|
|
|
|
$date = null; |
|
|
$date = null; |
|
|
$file = null; |
|
|
$file = null; |
|
|
|
|
|
|
|
|
$fieldValue = isset($setting['default']) ? $setting['default'] : null; |
|
|
|
|
|
|
|
|
$valueDefault = isset($setting['default']) ? $this->settingSolver->getDefaultValue($entity, $setting['default']) : null; |
|
|
|
|
|
|
|
|
if ($setting['field'] == 'text') { |
|
|
if ($setting['field'] == 'text') { |
|
|
$text = $fieldValue; |
|
|
|
|
|
|
|
|
$text = $valueDefault; |
|
|
} elseif ($setting['field'] == 'date') { |
|
|
} elseif ($setting['field'] == 'date') { |
|
|
$date = $fieldValue; |
|
|
|
|
|
|
|
|
$date = $valueDefault; |
|
|
} elseif ($setting['field'] == 'file') { |
|
|
} elseif ($setting['field'] == 'file') { |
|
|
$file = $fieldValue; |
|
|
|
|
|
|
|
|
$file = $valueDefault; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$entitySetting = $factory->create($entity, $setting['name'], $text, $date, $file); |
|
|
$entitySetting = $factory->create($entity, $setting['name'], $text, $date, $file); |
|
|
|
|
|
|
|
|
if ($this->settingSolver->getValue($entitySetting) === null |
|
|
if ($this->settingSolver->getValue($entitySetting) === null |
|
|
&& isset($setting['default']) |
|
|
&& isset($setting['default']) |
|
|
&& $setting['default'] !== null) { |
|
|
&& $setting['default'] !== null) { |
|
|
$methodSetValue = 'set' . ucfirst($setting['field']); |
|
|
|
|
|
$entitySetting->$methodSetValue($setting['default']); |
|
|
|
|
|
$this->entityManager->update($entitySetting); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$valueDefault = $this->settingSolver->getDefaultValue($entity, $setting['default']); |
|
|
|
|
|
|
|
|
|
|
|
if($valueDefault) { |
|
|
|
|
|
$methodSetValue = 'set' . ucfirst($setting['field']); |
|
|
|
|
|
$entitySetting->$methodSetValue($valueDefault); |
|
|
|
|
|
$this->entityManager->update($entitySetting); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |