Class yii\elasticsearch\QueryBuilder
| Inheritance | yii\elasticsearch\QueryBuilder » yii\base\BaseObject |
|---|---|
| Implements | yii\base\Configurable |
| Available since version | 2.0 |
| Source Code | https://github.com/yiisoft/yii2-elasticsearch/blob/master/QueryBuilder.php |
QueryBuilder builds an Elasticsearch query based on the specification given as a yii\elasticsearch\Query object.
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $db | yii\elasticsearch\Connection | The database connection. | yii\elasticsearch\QueryBuilder |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __call() | Calls the named method which is not a class method. | yii\base\BaseObject |
| __construct() | Constructor. | yii\elasticsearch\QueryBuilder |
| __get() | Returns the value of an object property. | yii\base\BaseObject |
| __isset() | Checks if a property is set, i.e. defined and not null. | yii\base\BaseObject |
| __set() | Sets value of an object property. | yii\base\BaseObject |
| __unset() | Sets an object property to null. | yii\base\BaseObject |
| build() | Generates query from a yii\elasticsearch\Query object. | yii\elasticsearch\QueryBuilder |
| buildCondition() | Parses the condition specification and generates the corresponding SQL expression. | yii\elasticsearch\QueryBuilder |
| buildOrderBy() | Adds order by condition to the query | yii\elasticsearch\QueryBuilder |
| buildQueryFromWhere() | yii\elasticsearch\QueryBuilder | |
| canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\BaseObject |
| canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\BaseObject |
| className() | Returns the fully qualified name of this class. | yii\base\BaseObject |
| hasMethod() | Returns a value indicating whether a method is defined. | yii\base\BaseObject |
| hasProperty() | Returns a value indicating whether a property is defined. | yii\base\BaseObject |
| init() | Initializes the object. | yii\base\BaseObject |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| buildCompositeInCondition() | yii\elasticsearch\QueryBuilder |
Property Details
Method Details
Constructor.
| public void __construct ( $connection, $config = [] ) | ||
| $connection | yii\elasticsearch\Connection | The database connection. |
| $config | array | Name-value pairs that will be used to initialize the object properties |
Generates query from a yii\elasticsearch\Query object.
| public array build ( $query ) | ||
| $query | yii\elasticsearch\Query | The yii\elasticsearch\Query object from which the query will be generated |
| return | array | The generated SQL statement (the first array element) and the corresponding parameters to be bound to the SQL statement (the second array element). |
|---|---|---|
| protected void buildCompositeInCondition ( $operator, $columns, $values ) | ||
| $operator | ||
| $columns | ||
| $values | ||
Parses the condition specification and generates the corresponding SQL expression.
| public string buildCondition ( $condition ) | ||
| $condition | string|array | The condition specification. Please refer to yii\elasticsearch\Query::where() on how to specify a condition. |
| return | string | The generated SQL expression |
|---|---|---|
| throws | yii\base\InvalidArgumentException | if unknown operator is used in query |
| throws | yii\base\NotSupportedException | if string conditions are used in where |
Adds order by condition to the query
| public void buildOrderBy ( $columns ) | ||
| $columns | ||
| public void buildQueryFromWhere ( $condition ) | ||
| $condition | ||