db\ActiveRecordInterface insert()

insert() public abstract method

Inserts the record into the database using the attribute values of this record.

Usage example:

$customer = new Customer;
$customer->name = $name;
$customer->email = $email;
$customer->insert();
public abstract boolean insert ( $runValidation = true, $attributes = 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.

$attributes array

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

return boolean

Whether the attributes are valid and the record is inserted successfully.

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

Please login to continue.