db\ActiveRecord update()

update() public method Saves the changes to this active record into the associated database table. This method performs the following steps in order: call beforeValidate() when $runValidation is true. If beforeValidate() returns false, the rest of the steps will be skipped; call afterValidate() when $runValidation is true. If validation failed, the rest of the steps will be skipped; call beforeSave(). If beforeSave() returns false, the rest of the steps will be skipped; save the record into

db\ActiveRecord transactions()

transactions() public method Declares which DB operations should be performed within a transaction in different scenarios. The supported DB operations are: OP_INSERT, OP_UPDATE and OP_DELETE, which correspond to the insert(), update() and delete() methods, respectively. By default, these methods are NOT enclosed in a DB transaction. In some scenarios, to ensure data consistency, you may want to enclose some or all of them in transactions. You can do so by overriding this method and returnin

db\ActiveRecord tableName()

tableName() public static method Declares the name of the database table associated with this AR class. By default this method returns the class name as the table name by calling yii\helpers\Inflector::camel2id() with prefix yii\db\Connection::$tablePrefix. For example if yii\db\Connection::$tablePrefix is tbl_, Customer becomes tbl_customer, and OrderItem becomes tbl_order_item. You may override this method if the table is not named after this convention. public static string tableName (

db\ActiveRecord primaryKey()

primaryKey() public static method Returns the primary key name(s) for this AR class. The default implementation will return the primary key(s) as declared in the DB table that is associated with this AR class. If the DB table does not declare any primary key, you should override this method to return the attributes that you want to use as primary keys for this AR class. Note that an array should be returned even for a table with single primary key. public static string[] primaryKey ( )ret

db\ActiveRecord populateRecord()

populateRecord() public static method Populates an active record object using a row of data from the database/storage. This is an internal method meant to be called to create active record objects after fetching data from the database. It is mainly used by yii\db\ActiveQuery to populate the query results into active records. When calling this method manually you should call afterFind() on the created record to trigger the afterFind Event. public static void populateRecord ( $record, $row

db\ActiveRecord loadDefaultValues()

loadDefaultValues() public method Loads default values from database table schema You may call this method to load default values after creating a new instance: // class Customer extends \yii\db\ActiveRecord $customer = new Customer(); $customer->loadDefaultValues(); public $this loadDefaultValues ( $skipIfSet = true )$skipIfSet boolean Whether existing value should be preserved. This will only set defaults for attributes that are null. return $this The model instance itself.

db\ActiveRecord isTransactional()

isTransactional() public method Returns a value indicating whether the specified operation is transactional in the current $scenario. public boolean isTransactional ( $operation )$operation integer The operation to check. Possible values are OP_INSERT, OP_UPDATE and OP_DELETE. return boolean Whether the specified operation is transactional in the current $scenario.

db\ActiveRecord insertInternal()

insertInternal() protected method Inserts an ActiveRecord into DB without considering transaction. protected boolean insertInternal ( $attributes = null )$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 record is inserted successfully.

db\ActiveRecord insert()

insert() public method Inserts a row into the associated database table using the attribute values of this record. This method performs the following steps in order: call beforeValidate() when $runValidation is true. If beforeValidate() returns false, the rest of the steps will be skipped; call afterValidate() when $runValidation is true. If validation failed, the rest of the steps will be skipped; call beforeSave(). If beforeSave() returns false, the rest of the steps will be skipped; inse

db\ActiveRecord getTableSchema()

getTableSchema() public static method Returns the schema information of the DB table associated with this AR class. public static yii\db\TableSchema getTableSchema ( )return yii\db\TableSchema The schema information of the DB table associated with this AR class. throws yii\base\InvalidConfigException if the table for the AR class does not exist.