Class yii\db\conditions\ExistsCondition

Inheritanceyii\db\conditions\ExistsCondition
Implementsyii\db\conditions\ConditionInterface
Available since version2.0.14
Source Code https://github.com/yiisoft/yii2/blob/master/framework/db/conditions/ExistsCondition.php

Condition that represents EXISTS operator.

Method Details

Hide inherited methods

__construct() public method

ExistsCondition constructor.

public void __construct ( $operator, $query )
$operator string

The operator to use (e.g. EXISTS or NOT EXISTS)

$query yii\db\Query

The yii\db\Query object representing the sub-query.

                public function __construct($operator, $query)
{
    $this->operator = $operator;
    $this->query = $query;
}

            
fromArrayDefinition() public static method

Creates object by array-definition as described in Query Builder – Operator format guide article.

public static $this fromArrayDefinition ( $operator, $operands )
$operator string

Operator in uppercase.

$operands array

Array of corresponding operands

throws yii\base\InvalidParamException

if input parameters are not suitable for this condition

                public static function fromArrayDefinition($operator, $operands)
{
    if (!isset($operands[0]) || !$operands[0] instanceof Query) {
        throw new InvalidArgumentException('Subquery for EXISTS operator must be a Query object.');
    }
    return new static($operator, $operands[0]);
}

            
getOperator() public method

public string getOperator ( )

                public function getOperator()
{
    return $this->operator;
}

            
getQuery() public method

public yii\db\Query getQuery ( )

                public function getQuery()
{
    return $this->query;
}