1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
updatebyfiltertrait.php
См. документацию.
1<?php
2
4
8
9trait UpdateByFilterTrait
10{
11 public static function updateByFilter(array $filter, array $fields): UpdateResult
12 {
13 $result = new UpdateResult();
14
15 $entity = static::getEntity();
16 $sqlTableName = static::getTableName();
17 $sqlHelper = $entity->getConnection()->getSqlHelper();
18
19 $update = $sqlHelper->prepareUpdate($sqlTableName, $fields);
20 try
21 {
22 $where = Query::buildFilterSql($entity, $filter);
23 } catch (\Throwable $e)
24 {
25 return $result->addError(new Error("Could not construct the update query: {$e->getMessage()}"));
26 }
27
28 if ($where !== '' && $update[0] !== '')
29 {
30 $sql = "UPDATE {$sqlTableName} SET {$update[0]} WHERE {$where}";
31 $entity->getConnection()->queryExecute($sql);
32 $result->setAffectedRowsCount($entity->getConnection());
33
34 static::cleanCache();
35 }
36 else
37 {
38 $result->addError(new Error("Could not execute the update query"));
39 }
40
41 return $result;
42 }
43}
Определения error.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$entity
$filter
Определения iblock_catalog_list.php:54
Определения chain.php:3
$fields
Определения yandex_run.php:501