redis\ActiveRecord updateAll()

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 customers whose status is 2:

Customer::updateAll(['status' => 1], ['id' => 2]);
public static integer updateAll ( $attributes, $condition = null )
$attributes array

Attribute values (name-value pairs) to be saved into the table

$condition array

The conditions that will be put in the WHERE part of the UPDATE SQL. Please refer to yii\redis\ActiveQuery::where() on how to specify this parameter.

return integer

The number of rows updated

doc_Yii
2016-10-30 17:10:42
Comments
Leave a Comment

Please login to continue.