93 public static function merge(array $data)
100 foreach (static::getEntity()->getFields() as $field)
102 if ($field instanceof
ScalarField && !array_key_exists($field->getName(), $data))
104 $defaultValue = $field->getDefaultValue();
106 if ($defaultValue !==
null)
108 $data[$field->getName()] = $field->getDefaultValue();
113 static::checkFields($result,
null, $data);
116 foreach ($data as $fieldName => $value)
118 $field = static::getEntity()->getField($fieldName);
119 $data[$fieldName] = $field->modifyValueBeforeSave($value, $data);
125 unset($updateData[
'ROUTE']);
126 $merge = $helper->prepareMerge(
127 static::getTableName(),
139 $updatedRecord = static::getByRoute($data[
'ROUTE']);
140 $id = $updatedRecord[
'ID'];
143 $result->setData($data);
147 $result->addError(
new Main\
Error(
'Error constructing query'));
150 catch (\Exception $e)
153 $result->isSuccess();