Fixed regexp in tests

This commit is contained in:
SilverFire - Dmitry Naumenko
2018-02-20 23:56:36 +02:00
parent d0e52c6172
commit 4fbece20ce
5 changed files with 57 additions and 2 deletions

View File

@ -0,0 +1,52 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\db\mysql;
use yii\db\ExpressionInterface;
use yii\db\JsonExpression;
/**
* Class ColumnSchema
*
* @author Dmytro Naumenko <d.naumenko.a@gmail.com>
* @since 2.0.14.1
*/
class ColumnSchema extends \yii\db\ColumnSchema
{
/**
* {@inheritdoc}
*/
public function dbTypecast($value)
{
if ($value instanceof ExpressionInterface) {
return $value;
}
if ($this->dbType === Schema::TYPE_JSON) {
return new JsonExpression($value, $this->type);
}
return $this->typecast($value);
}
/**
* {@inheritdoc}
*/
public function phpTypecast($value)
{
if ($value === null) {
return null;
}
if ($this->type === Schema::TYPE_JSON) {
return json_decode($value, true);
}
return parent::phpTypecast($value);
}
}