# IntegrityException

> Exception represents an exception that is caused by violation of DB constraints.

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

| class | `yii\db\IntegrityException` |
| --- | --- |
| Extends | [`Exception`](/docs/api/yii/db/exception/index.md) » [`yii\base\Exception`](/docs/api/yii/base/exception/index.md) » [`Exception`](https://www.php.net/manual/en/class.exception.php) |
| Since | 2.0 |
| Source | [`framework/db/IntegrityException.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/db/IntegrityException.php#L17) |

Exception represents an exception that is caused by violation of DB constraints.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-errorInfo"></span>[`$errorInfo`](/docs/api/yii/db/exception/index.md#property-errorInfo) | `array` | The error info provided by a PDO exception. Default: `[]`. | [`Exception`](/docs/api/yii/db/exception/index.md) |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-__construct"></span>[`__construct()`](/docs/api/yii/db/exception/index.md#method-__construct) | Constructor. | [`Exception`](/docs/api/yii/db/exception/index.md) |
| <span id="method-__toString"></span>[`__toString()`](/docs/api/yii/db/exception/index.md#method-__toString) |  | [`Exception`](/docs/api/yii/db/exception/index.md) |
| [`getName()`](#method-getName) |  | `IntegrityException` |

## Method details

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

```php
public function getName(): string
```

**Returns**

`string`: The user-friendly name of this exception