updateAll() public static method
Updates the whole table using the provided attribute values and conditions.
For example, to change the status to be 1 for all articles which status is 2:
Article::updateAll(['status' => 1], 'status = 2');
| public static integer updateAll ( $attributes, $condition = '', $params = [] ) | ||
|---|---|---|
| $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 yii\sphinx\Query::where() on how to specify this parameter. |
| $params | array |
The parameters (name => value) to be bound to the query. |
| return | integer |
The number of rows updated |
Please login to continue.