db\ActiveRecord getDb()

getDb() public static method Returns the database connection used by this AR class. By default, the "db" application component is used as the database connection. You may override this method if you want to use a different database connection. public static yii\db\Connection getDb ( )return yii\db\Connection The database connection used by this AR class.

db\ActiveRecord findBySql()

findBySql() public static method Creates an yii\db\ActiveQuery instance with a given SQL statement. Note that because the SQL statement is already specified, calling additional query modification methods (such as where(), order()) on the created yii\db\ActiveQuery instance will have no effect. However, calling with(), asArray() or indexBy() is still fine. Below is an example: $customers = Customer::findBySql('SELECT * FROM customer')->all(); public static yii\db\ActiveQuery findBySql

db\ActiveRecord findByCondition()

findByCondition() protected static method Finds ActiveRecord instance(s) by the given condition. This method is internally called by findOne() and findAll(). protected static yii\db\ActiveQueryInterface findByCondition ( $condition )$condition mixed Please refer to findOne() for the explanation of this parameter return yii\db\ActiveQueryInterface The newly created ActiveQuery instance. throws yii\base\InvalidConfigException if there is no primary key defined

db\ActiveRecord find()

find() public static method Creates an yii\db\ActiveQueryInterface instance for query purpose. The returned yii\db\ActiveQueryInterface instance can be further customized by calling methods defined in yii\db\ActiveQueryInterface before one() or all() is called to return populated ActiveRecord instances. For example, // find the customer whose ID is 1 $customer = Customer::find()->where(['id' => 1])->one(); // find all active customers and order them by their age: $customers = Cust

db\ActiveRecord equals()

equals() public method Returns a value indicating whether the given active record is the same as the current one. The comparison is made by comparing the table names and the primary key values of the two active records. If one of the records is new they are also considered not equal. public boolean equals ( $record )$record yii\db\ActiveRecord Record to compare to return boolean Whether the two active records refer to the same row in the same database table.

db\ActiveRecord deleteInternal()

deleteInternal() protected method Deletes an ActiveRecord without considering transaction. protected integer|false deleteInternal ( )return integer|false The number of rows deleted, or false if the deletion is unsuccessful for some reason. Note that it is possible the number of rows deleted is 0, even though the deletion execution is successful. throws yii\db\StaleObjectException

db\ActiveRecord deleteAll()

deleteAll() public static method Deletes rows in the table using the provided conditions. WARNING: If you do not specify any condition, this method will delete ALL rows in the table. For example, to delete all customers whose status is 3: Customer::deleteAll('status = 3'); public static integer deleteAll ( $condition = '', $params = [] )$condition string|array The conditions that will be put in the WHERE part of the DELETE SQL. Please refer to yii\db\Query::where() on how to specify t

db\ActiveRecord delete()

delete() public method Deletes the table row corresponding to this active record. This method performs the following steps in order: call beforeDelete(). If the method returns false, it will skip the rest of the steps; delete the record from the database; call afterDelete(). In the above step 1 and 3, events named EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE will be raised by the corresponding methods. public integer|false delete ( )return integer|false The number of rows deleted, or fal

db\ActiveRecord attributes()

attributes() public method Returns the list of all attribute names of the model. The default implementation will return all column names of the table associated with this AR class. public array attributes ( )return array List of attribute names.

db\ActiveQueryTrait with()

with() public method Specifies the relations with which this query should be performed. The parameters to this method can be either one or multiple strings, or a single array of relation names and the optional callbacks to customize the relations. A relation name can refer to a relation defined in $modelClass or a sub-relation that stands for a relation of a related record. For example, orders.address means the address relation defined in the model class corresponding to the orders relation