yii\db\BaseActiveRecord::updateAllCounters PHP Метод

updateAllCounters() публичный статический Метод

For example, to increment all customers' age by 1, php Customer::updateAllCounters(['age' => 1]);
public static updateAllCounters ( array $counters, string | array $condition = '' ) : integer
$counters array the counters to be updated (attribute name => increment value). Use negative values if you want to decrement the counters.
$condition string | array 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.
Результат integer the number of rows updated
    public static function updateAllCounters($counters, $condition = '')
    {
        throw new NotSupportedException(__METHOD__ . ' is not supported.');
    }

Usage Example

Пример #1
0
 /**
  * @inheritdoc
  * @todo
  */
 public static function updateAllCounters($counters, $condition = '')
 {
     parent::updateAllCounters($counters, $condition);
 }