# NotCondition

> Condition that inverts passed condition.

[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) › NotCondition

| class | `yii\db\conditions\NotCondition` |
| --- | --- |
| Implements | [`ConditionInterface`](/docs/api/yii/db/conditions/conditioninterface/index.md) |
| Since | 2.0.14 |
| Source | [`framework/db/conditions/NotCondition.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/db/conditions/NotCondition.php#L20) |

Condition that inverts passed `condition`.

## Methods

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

## Method details

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

```php
public function __construct(mixed $condition)
```

NotCondition constructor.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$condition` | `mixed` | The condition to be negated |

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

```php
public static function fromArrayDefinition(mixed $operator, mixed $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` | `mixed` | Operator in uppercase. |
| `$operands` | `mixed` | Array of corresponding operands |

**Returns**

`static`

**Throws**

- [`yii\base\InvalidArgumentException`](/docs/api/yii/base/invalidargumentexception/index.md): if wrong number of operands have been given.

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

```php
public function getCondition(): mixed
```

**Returns**

`mixed`