db\ActiveRecordInterface update()

update() public abstract method

Saves the changes to this active record into the database.

Usage example:

$customer = Customer::findOne($id);
$customer->name = $name;
$customer->email = $email;
$customer->update();
public abstract integer|boolean update ( $runValidation = true, $attributeNames = null )
$runValidation boolean

Whether to perform validation (calling \yii\db\Model::validate()) before saving the record. Defaults to true. If the validation fails, the record will not be saved to the database and this method will return false.

$attributeNames array

List of attributes that need to be saved. Defaults to null, meaning all attributes that are loaded from DB will be saved.

return integer|boolean

The number of rows affected, or false if validation fails or updating process is stopped for other reasons. Note that it is possible that the number of rows affected is 0, even though the update execution is successful.

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

Please login to continue.