| 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.
| 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 |
ExistsCondition constructor.
public function __construct($operator, $query)
{
$this->operator = $operator;
$this->query = $query;
}
Creates object by array-definition as described in Query Builder – Operator format guide article.
| public static static fromArrayDefinition ( mixed $operator, mixed $operands ) | ||
| $operator | mixed |
Operator in uppercase. |
| $operands | mixed |
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]);
}
public function getOperator()
{
return $this->operator;
}
public function getQuery()
{
return $this->query;
}