yii\db\QueryBuilder::buildNotCondition PHP Method

buildNotCondition() public method

Inverts an SQL expressions with NOT operator.
public buildNotCondition ( string $operator, array $operands, array &$params ) : string
$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($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($operand, $params);
        }
        if ($operand === '') {
            return '';
        }
        return "{$operator} ({$operand})";
    }