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 |
$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). |
Please login to continue.