db\BaseActiveRecord save()

save() public method

Saves the current record.

This method will call insert() when $isNewRecord is true, or update() when $isNewRecord is false.

For example, to save a customer record:

$customer = new Customer; // or $customer = Customer::findOne($id);
$customer->name = $name;
$customer->email = $email;
$customer->save();
public boolean save ( $runValidation = true, $attributeNames = null )
$runValidation boolean

Whether to perform validation (calling 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 attribute names that need to be saved. Defaults to null, meaning all attributes that are loaded from DB will be saved.

return boolean

Whether the saving succeeded (i.e. no validation errors occurred).

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

Please login to continue.