85 public static function merge(array $data)
87 $result =
new Entity\AddResult();
92 $mergeFields = static::getMergeFields();
94 foreach ($mergeFields as $field)
96 unset($updateData[$field]);
99 $versionMain = \Bitrix\Main\ModuleManager::getVersion(
'main');
100 $isPgCompatible = (version_compare($versionMain,
'24.0.0') >= 0);
102 if (isset($updateData[
'SEARCH_CONTENT']))
110 $field =
'SEARCH_CONTENT';
112 $updateData[
'SEARCH_CONTENT'] =
new SqlExpression($helper->getConditionalAssignment($field, $updateData[
'SEARCH_CONTENT']));
115 if (isset($updateData[
'SEARCH_TITLE']))
123 $field =
'SEARCH_TITLE';
125 $updateData[
'SEARCH_TITLE'] =
new SqlExpression($helper->getConditionalAssignment($field, $updateData[
'SEARCH_TITLE']));
128 $merge = $helper->prepareMerge(
129 static::getTableName(),
130 static::getMergeFields(),
140 $result->setData($data);
144 $result->addError(
new Error(
'Error constructing query'));
155 if (isset($updateData[$primaryField]))
157 unset($updateData[$primaryField]);
160 if (isset($updateData[
'SEARCH_CONTENT']))
162 $updateData[
'SEARCH_CONTENT'] =
new SqlExpression($helper->getConditionalAssignment(
'SEARCH_CONTENT', $updateData[
'SEARCH_CONTENT']));
165 if (isset($updateData[
'SEARCH_TITLE']))
167 $updateData[
'SEARCH_TITLE'] =
new SqlExpression($helper->getConditionalAssignment(
'SEARCH_TITLE', $updateData[
'SEARCH_TITLE']));
170 $update = $helper->prepareUpdate(
171 static::getTableName(),
175 if ($update[0] !==
'')
178 "UPDATE " . static::getTableName() .
" SET " . $update[0] .
" WHERE " . $primaryField .
" = " . $id