yii\sphinx\QueryBuilder::buildBetweenCondition PHP Method

buildBetweenCondition() public method

Creates an SQL expressions with the BETWEEN operator.
public buildBetweenCondition ( IndexSchema[] $indexes, string $operator, array $operands, array &$params ) : string
$indexes IndexSchema[] list of indexes, which affected by query
$operator string the operator to use (e.g. `BETWEEN` or `NOT BETWEEN`)
$operands array the first operand is the column name. The second and third operands describe the interval that column value should be in.
$params array the binding parameters to be populated
return string the generated SQL expression
    public function buildBetweenCondition($indexes, $operator, $operands, &$params)
    {
        if (!isset($operands[0], $operands[1], $operands[2])) {
            throw new Exception("Operator '{$operator}' requires three operands.");
        }
        list($column, $value1, $value2) = $operands;
        if (strpos($column, '(') === false) {
            $quotedColumn = $this->db->quoteColumnName($column);
        } else {
            $quotedColumn = $column;
        }
        $phName1 = $this->composeColumnValue($indexes, $column, $value1, $params);
        $phName2 = $this->composeColumnValue($indexes, $column, $value2, $params);
        return "{$quotedColumn} {$operator} {$phName1} AND {$phName2}";
    }