| 1 | <?php |
||
| 19 | class QueryBuilder extends \yii\elasticsearch\QueryBuilder |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Parses the condition specification and generates the corresponding SQL expression. |
||
| 23 | * |
||
| 24 | * @param string|array $condition the condition specification. Please refer to [[Query::where()]] on how to specify a condition. |
||
| 25 | * @throws \yii\base\InvalidParamException if unknown operator is used in query |
||
| 26 | * @throws \yii\base\NotSupportedException if string conditions are used in where |
||
| 27 | * @return string the generated SQL expression |
||
| 28 | */ |
||
| 29 | public function buildCondition($condition) |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Generates query from a [[Query]] object. |
||
| 39 | * @param Query $query the [[Query]] object from which the query will be generated |
||
| 40 | * @return array the generated SQL statement (the first array element) and the corresponding |
||
| 41 | * parameters to be bound to the SQL statement (the second array element). |
||
| 42 | */ |
||
| 43 | public function build($query) |
||
| 51 | } |
||
| 52 |
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: