framework/db/ActiveRecord.php
public static function updateAllCounters($counters, $condition = '', $params = [])
    {
        $n = 0;
        foreach ($counters as $name => $value) {
            $counters[$name] = new Expression("[[$name]]+:bp{$n}", [":bp{$n}" => $value]);
            $n++;
        }
        $command = static::getDb()->createCommand();
        $command->update(static::tableName(), $counters, $condition, $params);

        return $command->execute();
    }
public static function updateAllCounters($counters, $condition = '', $params = [])
    {
        $n = 0;
        foreach ($counters as $name => $value) {
            $counters[$name] = new Expression("[[$name]]+:bp{$n}", [":bp{$n}" => $value]);
            $n++;
        }
        $command = static::getDb()->createCommand();
        $command->update(static::tableName(), $counters, $condition, $params);

        return $command->execute();
    }
Updates the whole table using the provided counter changes and conditions.

For example, to increment all customers' age by 1,

```php
Customer::updateAllCounters(['age' => 1]);
```

Note that this method will not trigger any events.

@param array $counters the counters to be updated (attribute name => increment value).
Use negative values if you want to decrement the counters.
@param string|array $condition the conditions that will be put in the WHERE part of the UPDATE SQL.
Please refer to [[Query::where()]] on how to specify this parameter.
@param array $params the parameters (name => value) to be bound to the query.
Do not name the parameters as `:bp0`, `:bp1`, etc., because they are used internally by this method.
@return int the number of rows updated