Class yii\db\ColumnSchema

继承yii\db\ColumnSchema » yii\base\BaseObject
实现yii\base\Configurable
子类yii\db\mysql\ColumnSchema, yii\db\pgsql\ColumnSchema
可用自版本2.0
源代码 https://github.com/yiisoft/yii2/blob/master/framework/db/ColumnSchema.php

ColumnSchema class describes the metadata of a column in a database table.

公共属性

隐藏继承的属性

属性类型描述定义在
$allowNull boolean Whether this column can be null. yii\db\ColumnSchema
$autoIncrement boolean Whether this column is auto-incremental yii\db\ColumnSchema
$comment string Comment of this column. yii\db\ColumnSchema
$dbType string The DB type of this column. yii\db\ColumnSchema
$defaultValue mixed Default value of this column yii\db\ColumnSchema
$enumValues array Enumerable values. yii\db\ColumnSchema
$isPrimaryKey boolean Whether this column is a primary key yii\db\ColumnSchema
$name string Name of this column (without quotes). yii\db\ColumnSchema
$phpType string The PHP type of this column. yii\db\ColumnSchema
$precision integer Precision of the column data, if it is numeric. yii\db\ColumnSchema
$scale integer Scale of the column data, if it is numeric. yii\db\ColumnSchema
$size integer Display size of the column. yii\db\ColumnSchema
$type string Abstract type of this column. yii\db\ColumnSchema
$unsigned boolean Whether this column is unsigned. yii\db\ColumnSchema

公共方法

隐藏继承的方法

方法描述定义在
__call() 调用不是类方法的已命名方法. yii\base\BaseObject
__construct() 构造函数. yii\base\BaseObject
__get() 返回对象属性的值. yii\base\BaseObject
__isset() 检查属性是否已设置, 即已定义且不为null. yii\base\BaseObject
__set() 设置对象属性的值. yii\base\BaseObject
__unset() 将对象属性设置为null. yii\base\BaseObject
canGetProperty() 返回一个值, 指示属性是否可读. yii\base\BaseObject
canSetProperty() 返回一个值, 指示属性是否可写. yii\base\BaseObject
className() 返回此类的完全限定名称. yii\base\BaseObject
dbTypecast() Converts the input value according to $type and $dbType for use in a db query. yii\db\ColumnSchema
hasMethod() 返回一个值, 指示方法是否已定义. yii\base\BaseObject
hasProperty() 返回一个值, 指示属性是否已定义. yii\base\BaseObject
init() 初始化对象. yii\base\BaseObject
phpTypecast() Converts the input value according to $phpType after retrieval from the database. yii\db\ColumnSchema

受保护的方法

隐藏继承的方法

方法描述定义在
typecast() Converts the input value according to $phpType after retrieval from the database. yii\db\ColumnSchema

属性详情

$allowNull public 属性

Whether this column can be null.

public boolean $allowNull null
$autoIncrement public 属性

Whether this column is auto-incremental

public boolean $autoIncrement false
$comment public 属性

Comment of this column. Not all DBMS support this.

public string $comment null
$dbType public 属性

The DB type of this column. Possible DB types vary according to the type of DBMS.

public string $dbType null
$defaultValue public 属性

Default value of this column

public mixed $defaultValue null
$enumValues public 属性

Enumerable values. This is set only if the column is declared to be an enumerable type.

public array $enumValues null
$isPrimaryKey public 属性

Whether this column is a primary key

public boolean $isPrimaryKey null
$name public 属性

Name of this column (without quotes).

public string $name null
$phpType public 属性

The PHP type of this column. Possible PHP types include: string, boolean, integer, double, array.

public string $phpType null
$precision public 属性

Precision of the column data, if it is numeric.

public integer $precision null
$scale public 属性

Scale of the column data, if it is numeric.

public integer $scale null
$size public 属性

Display size of the column.

public integer $size null
$type public 属性

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 string $type null
$unsigned public 属性

Whether this column is unsigned. This is only meaningful when $type is smallint, integer or bigint.

public boolean $unsigned null

方法详情

dbTypecast() public 方法

Converts the input value according to $type and $dbType for use in a db query.

If the value is null or an yii\db\Expression, it will not be converted.

public mixed dbTypecast ( $value )
$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 方法

Converts the input value according to $phpType after retrieval from the database.

If the value is null or an yii\db\Expression, it will not be converted.

public mixed phpTypecast ( $value )
$value mixed

Input value

return mixed

Converted value

typecast() protected 方法 (可用自版本: 2.0.3)

Converts the input value according to $phpType after retrieval from the database.

If the value is null or an yii\db\Expression, it will not be converted.

protected mixed typecast ( $value )
$value mixed

Input value

return mixed

Converted value