# PdoValue

> Class PdoValue represents a $value that should be bound to PDO with exact $type.

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

| final class | `yii\db\PdoValue` |
| --- | --- |
| Implements | [`ExpressionInterface`](/docs/api/yii/db/expressioninterface/index.md) |
| Since | 2.0.14 |
| Source | [`framework/db/PdoValue.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/db/PdoValue.php#L27) |

Class PdoValue represents a $value that should be bound to PDO with exact $type.

For example, it will be useful when you need to bind binary data to BLOB column in DBMS:

```
[':name' => 'John', ':profile' => new PdoValue($profile, \PDO::PARAM_LOB)]`.
```

To see possible types, check [PDO::PARAM_* constants](https://www.php.net/manual/en/pdo.constants.php).

See also: <https://www.php.net/manual/en/pdostatement.bindparam.php>.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | PdoValue constructor. | `PdoValue` |
| [`getType()`](#method-getType) |  | `PdoValue` |
| [`getValue()`](#method-getValue) |  | `PdoValue` |

## Method details

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

```php
public function __construct(mixed $value, mixed $type)
```

PdoValue constructor.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `mixed` |  |
| `$type` | `mixed` |  |

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

```php
public function getType(): int
```

**Returns**

`int`

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

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

**Returns**

`mixed`