db\ActiveRecordInterface updateAll()

updateAll() public abstract static method

Updates records 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], ['status' => '2']);
public abstract static integer updateAll ( $attributes, $condition = null )
$attributes array

Attribute values (name-value pairs) to be saved for the record. Unlike update() these are not going to be validated.

$condition array

The condition that matches the records that should get updated. Please refer to yii\db\QueryInterface::where() on how to specify this parameter. An empty condition will match all records.

return integer

The number of rows updated

doc_Yii
2016-10-30 16:56:30
Comments
Leave a Comment

Please login to continue.