Skip to content
PHP Ecosystem
Explore

PdoValue

API reference › yii › db › PdoValue

final classyii\db\PdoValue
ImplementsExpressionInterface
Since2.0.14
Sourceframework/db/PdoValue.php

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.

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

MethodDescriptionDefined by
__construct()PdoValue constructor.PdoValue
getType()PdoValue
getValue()PdoValue
public function __construct(mixed $value, mixed $type)

PdoValue constructor.

Parameters

ParameterTypeDescription
$valuemixed
$typemixed
public function getType(): int

Returns

int

public function getValue(): mixed

Returns

mixed