For example, to change the status to be 1 for all customers whose status is 2:
php
Customer::updateAll(['status' => 1], 'status = 2');
public static updateAll ( array $attributes, string | array $condition = '' ) : integer | ||
$attributes | array | attribute values (name-value pairs) to be saved into the table |
$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 |