# Class yii\db\conditions\ExistsCondition

Inheritance | yii\db\conditions\ExistsCondition
Implements | yii\db\conditions\ConditionInterface
Available since version | 2.0.14
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/db/conditions/ExistsCondition.php

Condition that represents `EXISTS` operator.

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
__construct() | ExistsCondition constructor. | yii\db\conditions\ExistsCondition
fromArrayDefinition() | Creates object by array-definition as described in Query Builder – Operator format guide article. | yii\db\conditions\ExistsCondition
getOperator() |  | yii\db\conditions\ExistsCondition
getQuery() |  | yii\db\conditions\ExistsCondition

## Method Details

__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.

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

getOperator() public method

public string getOperator ( )

getQuery() public method

public yii\db\Query getQuery ( )