yii\sphinx\QueryBuilder::buildNotCondition PHP Method

buildNotCondition() public method

Inverts an SQL expressions with NOT operator.
public buildNotCondition ( IndexSchema[] $indexes, string $operator, array $operands, array &$params ) : string
$indexes IndexSchema[] list of indexes, which affected by query
$operator string the operator to use for connecting the given operands
$operands array the SQL expressions to connect.
$params array the binding parameters to be populated
return string the generated SQL expression
    public function buildNotCondition($indexes, $operator, $operands, &$params)
    {
        if (count($operands) != 1) {
            throw new InvalidParamException("Operator '{$operator}' requires exactly one operand.");
        }
        $operand = reset($operands);
        if (is_array($operand)) {
            $operand = $this->buildCondition($indexes, $operand, $params);
        }
        if ($operand === '') {
            return '';
        }
        return "{$operator} ({$operand})";
    }