db\ActiveQueryInterface asArray()

asArray() public abstract method Sets the asArray() property. public abstract $this asArray ( $value = true )$value boolean Whether to return the query results in terms of arrays instead of Active Records. return $this The query object itself

db\ActiveQuery __construct()

__construct() public method Constructor. public void __construct ( $modelClass, $config = [] )$modelClass string The model class associated with this query $config array Configurations to be applied to the newly created query object

db\ActiveQuery viaTable()

viaTable() public method Specifies the junction table for a relational query. Use this method to specify a junction table when declaring a relation in the yii\db\ActiveRecord class: public function getItems() { return $this->hasMany(Item::className(), ['id' => 'item_id']) ->viaTable('order_item', ['order_id' => 'id']); } See also via(). public $this viaTable ( $tableName, $link, callable $callable = null )$tableName string The name of the junction table.

db\ActiveQuery queryScalar()

queryScalar() protected method Queries a scalar value by setting select() first. Restores the value of select to make this query reusable. protected boolean|string queryScalar ( $selectExpression, $db )$selectExpression string|yii\db\Expression $db yii\db\Connection|null

db\ActiveQuery prepare()

prepare() public method Prepares for building SQL. This method is called by yii\db\QueryBuilder when it starts to build SQL from a query object. You may override this method to do some final preparation work when converting a query into a SQL statement. public $this prepare ( $builder )$builder yii\db\QueryBuilder return $this A prepared query instance which will be used by yii\db\QueryBuilder to build the SQL

db\ActiveQuery populate()

populate() public method Converts the raw query results into the format as specified by this query. This method is internally used to convert the data fetched from database into the format as required by this query. public array populate ( $rows )$rows array The raw query result from database return array The converted query result

db\ActiveQuery orOnCondition()

orOnCondition() public method Adds an additional ON condition to the existing one. The new condition and the existing one will be joined using the 'OR' operator. See also: onCondition() andOnCondition() public $this orOnCondition ( $condition, $params = [] )$condition string|array The new ON condition. Please refer to where() on how to specify this parameter. $params array The parameters (name => value) to be bound to the query. return $this The query object itself

db\ActiveQuery one()

one() public method Executes query and returns a single row of result. public yii\db\ActiveRecord|array|null one ( $db = null )$db yii\db\Connection The DB connection used to create the DB command. If null, the DB connection returned by $modelClass will be used. return yii\db\ActiveRecord|array|null A single row of query result. Depending on the setting of asArray(), the query result may be either an array or an ActiveRecord object. Null will be returned if the query results in nothi

db\ActiveQuery onCondition()

onCondition() public method Sets the ON condition for a relational query. The condition will be used in the ON part when yii\db\ActiveQuery::joinWith() is called. Otherwise, the condition will be used in the WHERE part of a query. Use this method to specify additional conditions when declaring a relation in the yii\db\ActiveRecord class: public function getActiveUsers() { return $this->hasMany(User::className(), ['id' => 'user_id']) ->onCondition(['active' =>

db\ActiveQuery joinWith()

joinWith() public method Joins with the specified relations. This method allows you to reuse existing relation definitions to perform JOIN queries. Based on the definition of the specified relation(s), the method will append one or multiple JOIN statements to the current query. If the $eagerLoading parameter is true, the method will also perform eager loading for the specified relations, which is equivalent to calling with() using the specified relations. Note that because a JOIN query will