db\QueryBuilder $conditionBuilders

$conditionBuilders protected property Map of query condition to builder methods. These methods are used by buildCondition() to build SQL conditions from array syntax. protected array $conditionBuilders = ['NOT' => 'buildNotCondition', 'AND' => 'buildAndCondition', 'OR' => 'buildAndCondition', 'BETWEEN' => 'buildBetweenCondition', 'NOT BETWEEN' => 'buildBetweenCondition', 'IN' => 'buildInCondition', 'NOT IN' => 'buildInCondition', 'LIKE' => 'buildLikeCondition', 'NOT

db\Query where()

where() public method Sets the WHERE part of the query. The method requires a $condition parameter, and optionally a $params parameter specifying the values to be bound to the query. The $condition parameter should be either a string (e.g. 'id=1') or an array. The $condition specified as an array can be in one of the following two formats: hash format: ['column1' => value1, 'column2' => value2, ...] operator format: [operator, operand1, operand2, ...] A condition in hash format repr

db\Query union()

union() public method Appends a SQL statement using UNION operator. public $this union ( $sql, $all = false )$sql string|yii\db\Query The SQL statement to be appended using UNION $all boolean TRUE if using UNION ALL and FALSE if using UNION return $this The query object itself

db\Query sum()

sum() public method Returns the sum of the specified column values. public mixed sum ( $q, $db = null )$q string The column name or expression. Make sure you properly quote column names in the expression. $db yii\db\Connection The database connection used to generate the SQL statement. If this parameter is not given, the db application component will be used. return mixed The sum of the specified column values.

db\Query select()

select() public method Sets the SELECT part of the query. public $this select ( $columns, $option = null )$columns string|array|yii\db\Expression The columns to be selected. Columns can be specified in either a string (e.g. "id, name") or an array (e.g. ['id', 'name']). Columns can be prefixed with table names (e.g. "user.id") and/or contain column aliases (e.g. "user.id AS user_id"). The method will automatically quote the column names unless a column contains some parenthesis (which

db\Query scalar()

scalar() public method Returns the query result as a scalar value. The value returned will be the first column in the first row of the query results. public string|null|false scalar ( $db = null )$db yii\db\Connection The database connection used to generate the SQL statement. If this parameter is not given, the db application component will be used. return string|null|false The value of the first column in the first row of the query result. False is returned if the query result is e

db\Query rightJoin()

rightJoin() public method Appends a RIGHT OUTER JOIN part to the query. public $this rightJoin ( $table, $on = '', $params = [] )$table string|array The table to be joined. Use a string to represent the name of the table to be joined. The table name can contain a schema prefix (e.g. 'public.user') and/or table alias (e.g. 'user u'). The method will automatically quote the table name unless it contains some parenthesis (which means the table is given as a sub-query or DB expression). Us

db\Query 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\Query 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\Query 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