Browse Source

Issue #15957: dropped deprecated ColumnSchema properties

See also #15716
tags/3.0.0-alpha1
Pavel Ivanov 7 years ago
parent
commit
893f2a7bbd
  1. 15
      framework/db/mysql/ColumnSchema.php
  2. 40
      framework/db/pgsql/ColumnSchema.php

15
framework/db/mysql/ColumnSchema.php

@ -19,17 +19,6 @@ use yii\db\JsonExpression;
class ColumnSchema extends \yii\db\ColumnSchema
{
/**
* @var bool whether the column schema should OMIT using JSON support feature.
* You can use this property to make upgrade to Yii 2.0.14 easier.
* Default to `false`, meaning JSON support is enabled.
*
* @since 2.0.14.1
* @deprecated Since 2.0.14.1 and will be removed in 2.1.
*/
public $disableJsonSupport = false;
/**
* {@inheritdoc}
*/
public function dbTypecast($value)
@ -38,7 +27,7 @@ class ColumnSchema extends \yii\db\ColumnSchema
return $value;
}
if (!$this->disableJsonSupport && $this->dbType === Schema::TYPE_JSON) {
if ($this->dbType === Schema::TYPE_JSON) {
return new JsonExpression($value, $this->type);
}
@ -54,7 +43,7 @@ class ColumnSchema extends \yii\db\ColumnSchema
return null;
}
if (!$this->disableJsonSupport && $this->type === Schema::TYPE_JSON) {
if ($this->type === Schema::TYPE_JSON) {
return json_decode($value, true);
}

40
framework/db/pgsql/ColumnSchema.php

@ -22,34 +22,6 @@ class ColumnSchema extends \yii\db\ColumnSchema
* @var int the dimension of array. Defaults to 0, means this column is not an array.
*/
public $dimension = 0;
/**
* @var bool whether the column schema should OMIT using JSON support feature.
* You can use this property to make upgrade to Yii 2.0.14 easier.
* Default to `false`, meaning JSON support is enabled.
*
* @since 2.0.14.1
* @deprecated Since 2.0.14.1 and will be removed in 2.1.
*/
public $disableJsonSupport = false;
/**
* @var bool whether the column schema should OMIT using PgSQL Arrays support feature.
* You can use this property to make upgrade to Yii 2.0.14 easier.
* Default to `false`, meaning Arrays support is enabled.
*
* @since 2.0.14.1
* @deprecated Since 2.0.14.1 and will be removed in 2.1.
*/
public $disableArraySupport = false;
/**
* @var bool whether the Array column value should be unserialized to an [[ArrayExpression]] object.
* You can use this property to make upgrade to Yii 2.0.14 easier.
* Default to `true`, meaning arrays are unserialized to [[ArrayExpression]] objects.
*
* @since 2.0.14.1
* @deprecated Since 2.0.14.1 and will be removed in 2.1.
*/
public $deserializeArrayColumnToArrayExpression = true;
/**
* {@inheritdoc}
@ -60,10 +32,10 @@ class ColumnSchema extends \yii\db\ColumnSchema
return $value;
}
if (!$this->disableArraySupport && $this->dimension > 0) {
if ($this->dimension > 0) {
return new ArrayExpression($value, $this->dbType, $this->dimension);
}
if (!$this->disableJsonSupport && in_array($this->dbType, [Schema::TYPE_JSON, Schema::TYPE_JSONB], true)) {
if (in_array($this->dbType, [Schema::TYPE_JSON, Schema::TYPE_JSONB], true)) {
return new JsonExpression($value, $this->type);
}
@ -75,7 +47,7 @@ class ColumnSchema extends \yii\db\ColumnSchema
*/
public function phpTypecast($value)
{
if (!$this->disableArraySupport && $this->dimension > 0) {
if ($this->dimension > 0) {
if (!is_array($value)) {
$value = $this->getArrayParser()->parse($value);
}
@ -85,9 +57,7 @@ class ColumnSchema extends \yii\db\ColumnSchema
});
}
return $this->deserializeArrayColumnToArrayExpression
? new ArrayExpression($value, $this->dbType, $this->dimension)
: $value;
return new ArrayExpression($value, $this->dbType, $this->dimension);
}
return $this->phpTypecastValue($value);
@ -117,7 +87,7 @@ class ColumnSchema extends \yii\db\ColumnSchema
}
return (bool) $value;
case Schema::TYPE_JSON:
return $this->disableJsonSupport ? $value : json_decode($value, true);
return json_decode($value, true);
}
return parent::phpTypecast($value);

Loading…
Cancel
Save