0 follower

Final Class Yiisoft\Db\Oracle\Column\JsonColumn

InheritanceYiisoft\Db\Oracle\Column\JsonColumn » Yiisoft\Db\Schema\Column\AbstractJsonColumn

Represents a JSON column with eager parsing values retrieved from the database.

Public Methods

Hide inherited methods

Method Description Defined By
phpTypecast() Yiisoft\Db\Oracle\Column\JsonColumn

Method Details

Hide inherited methods

phpTypecast() public method

public mixed phpTypecast ( mixed $value )
$value mixed
throws JsonException

                public function phpTypecast(mixed $value): mixed
{
    if (is_string($value)) {
        return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
    }
    if (is_resource($value)) {
        /** @var string */
        $value = stream_get_contents($value);
        return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
    }
    return $value;
}