# ConditionInterface

> Interface ConditionInterface should be implemented by classes that represent a condition in DBAL of framework.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [db](/docs/api/yii/db/index.md) › [conditions](/docs/api/yii/db/conditions/index.md) › ConditionInterface

| interface | `yii\db\conditions\ConditionInterface` |
| --- | --- |
| Extends | [`yii\db\ExpressionInterface`](/docs/api/yii/db/expressioninterface/index.md) |
| Since | 2.0.14 |
| Source | [`framework/db/conditions/ConditionInterface.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/db/conditions/ConditionInterface.php#L21) |

Implemented by 8 types:

- [`BetweenColumnsCondition`](/docs/api/yii/db/conditions/betweencolumnscondition/index.md)
- [`BetweenCondition`](/docs/api/yii/db/conditions/betweencondition/index.md)
- [`ConjunctionCondition`](/docs/api/yii/db/conditions/conjunctioncondition/index.md)
- [`ExistsCondition`](/docs/api/yii/db/conditions/existscondition/index.md)
- [`HashCondition`](/docs/api/yii/db/conditions/hashcondition/index.md)
- [`InCondition`](/docs/api/yii/db/conditions/incondition/index.md)
- [`NotCondition`](/docs/api/yii/db/conditions/notcondition/index.md)
- [`SimpleCondition`](/docs/api/yii/db/conditions/simplecondition/index.md)

Interface ConditionInterface should be implemented by classes that represent a condition
in DBAL of framework.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`fromArrayDefinition()`](#method-fromArrayDefinition) static abstract | Creates object by array-definition as described in [Query Builder – Operator format](/docs/guide/db-query-builder/index.md#operator-format) guide article. | `ConditionInterface` |

## Method details

### fromArrayDefinition() <span id="method-fromArrayDefinition"></span>

```php
abstract public static function fromArrayDefinition(string $operator, array $operands): static
```

Creates object by array-definition as described in
[Query Builder – Operator format](/docs/guide/db-query-builder/index.md#operator-format) guide article.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$operator` | `string` | Operator in uppercase. |
| `$operands` | `array` | Array of corresponding operands |

**Returns**

`static`

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): if input parameters are not suitable for this condition