elasticsearch\ActiveRecord updateAllCounters()

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 where() method when building the query. Please refer to yii\elasticsearch\ActiveQuery::where() on how to specify this parameter.

return integer

The number of rows updated

throws yii\elasticsearch\Exception

on error.

doc_Yii
2016-10-30 17:01:28
Comments
Leave a Comment

Please login to continue.