7trait UpdateByFilterTrait
13 public static function updateByFilter(array $filter, array $fields)
15 $entity = static::getEntity();
16 $sqlTableName = static::getTableName();
17 $sqlHelper = $entity->getConnection()->getSqlHelper();
19 $update = $sqlHelper->prepareUpdate($sqlTableName, $fields);
20 $where = Query::buildFilterSql($entity, $filter);
21 if ($where !==
'' && $update[0] !==
'')
23 $sql =
"UPDATE {$sqlTableName} SET {$update[0]} WHERE {$where}";
24 $entity->getConnection()->queryExecute($sql);