updateAllCounters() public static method
Updates all matching records using the provided counter changes and conditions.
For example, to add 1 to age of all customers whose status is 2,
Customer::updateAllCounters(['age' => 1], ['status' => 2]);
See also [[yii\elasticsearch\ActiveRecord::primaryKeysByCondition()]].
public static integer updateAllCounters ( $counters, $condition = [] ) | ||
---|---|---|
$counters | array |
The counters to be updated (attribute name => increment value). Use negative values if you want to decrement the counters. |
$condition | array |
The conditions that will be passed to the |
return | integer |
The number of rows updated |
throws | yii\elasticsearch\Exception |
on error. |
Please login to continue.