yii\db\QueryBuilder::buildExistsCondition PHP Méthode

buildExistsCondition() public méthode

Creates an SQL expressions with the EXISTS operator.
public buildExistsCondition ( string $operator, array $operands, array &$params ) : string
$operator string the operator to use (e.g. `EXISTS` or `NOT EXISTS`)
$operands array contains only one element which is a [[Query]] object representing the sub-query.
$params array the binding parameters to be populated
Résultat string the generated SQL expression
    public function buildExistsCondition($operator, $operands, &$params)
    {
        if ($operands[0] instanceof Query) {
            list($sql, $params) = $this->build($operands[0], $params);
            return "{$operator} ({$sql})";
        } else {
            throw new InvalidParamException('Subquery for EXISTS operator must be a Query object.');
        }
    }