Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
UpdateByFilterTrait.php
1<?php
2
3namespace Bitrix\Im\V2\Common;
4
6
7trait UpdateByFilterTrait
8{
13 public static function updateByFilter(array $filter, array $fields)
14 {
15 $entity = static::getEntity();
16 $sqlTableName = static::getTableName();
17 $sqlHelper = $entity->getConnection()->getSqlHelper();
18
19 $update = $sqlHelper->prepareUpdate($sqlTableName, $fields);
20 $where = Query::buildFilterSql($entity, $filter);
21 if ($where !== '' && $update[0] !== '')
22 {
23 $sql = "UPDATE {$sqlTableName} SET {$update[0]} WHERE {$where}";
24 $entity->getConnection()->queryExecute($sql);
25 }
26 }
27}