PHP Class yii\db\ColumnSchema

Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\base\Object
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$allowNull whether this column can be null.
$autoIncrement whether this column is auto-incremental
$comment comment of this column. Not all DBMS support this.
$dbType the DB type of this column. Possible DB types vary according to the type of DBMS.
$defaultValue default value of this column
$enumValues enumerable values. This is set only if the column is declared to be an enumerable type.
$isPrimaryKey whether this column is a primary key
$name name of this column (without quotes).
$phpType the PHP type of this column. Possible PHP types include: string, boolean, integer, double.
$precision precision of the column data, if it is numeric.
$scale scale of the column data, if it is numeric.
$size display size of the column.
$type abstract type of this column. Possible abstract types include: char, string, text, boolean, smallint, integer, bigint, float, decimal, datetime, timestamp, time, date, binary, and money.
$unsigned whether this column is unsigned. This is only meaningful when [[type]] is smallint, integer or bigint.

Public Methods

Method Description
dbTypecast ( mixed $value ) : mixed Converts the input value according to [[type]] and [[dbType]] for use in a db query.
phpTypecast ( mixed $value ) : mixed Converts the input value according to [[phpType]] after retrieval from the database.

Protected Methods

Method Description
typecast ( mixed $value ) : mixed Converts the input value according to [[phpType]] after retrieval from the database.

Method Details

dbTypecast() public method

If the value is null or an [[Expression]], it will not be converted.
public dbTypecast ( mixed $value ) : mixed
$value mixed input value
return mixed converted value. This may also be an array containing the value as the first element and the PDO type as the second element.

phpTypecast() public method

If the value is null or an [[Expression]], it will not be converted.
public phpTypecast ( mixed $value ) : mixed
$value mixed input value
return mixed converted value

typecast() protected method

If the value is null or an [[Expression]], it will not be converted.
Since: 2.0.3
protected typecast ( mixed $value ) : mixed
$value mixed input value
return mixed converted value

Property Details

$allowNull public property

whether this column can be null.
public $allowNull

$autoIncrement public property

whether this column is auto-incremental
public $autoIncrement

$comment public property

comment of this column. Not all DBMS support this.
public $comment

$dbType public property

the DB type of this column. Possible DB types vary according to the type of DBMS.
public $dbType

$defaultValue public property

default value of this column
public $defaultValue

$enumValues public property

enumerable values. This is set only if the column is declared to be an enumerable type.
public $enumValues

$isPrimaryKey public property

whether this column is a primary key
public $isPrimaryKey

$name public property

name of this column (without quotes).
public $name

$phpType public property

the PHP type of this column. Possible PHP types include: string, boolean, integer, double.
public $phpType

$precision public property

precision of the column data, if it is numeric.
public $precision

$scale public property

scale of the column data, if it is numeric.
public $scale

$size public property

display size of the column.
public $size

$type public property

abstract type of this column. Possible abstract types include: char, string, text, boolean, smallint, integer, bigint, float, decimal, datetime, timestamp, time, date, binary, and money.
public $type

$unsigned public property

whether this column is unsigned. This is only meaningful when [[type]] is smallint, integer or bigint.
public $unsigned