PHP 클래스 yii\db\ColumnSchemaBuilder

See SchemaBuilderTrait for more detailed description and usage examples.
부터: 2.0.6
저자: Vasenin Matvey ([email protected])
상속: extends yii\base\Object
파일 보기 프로젝트 열기: yiisoft/yii2

공개 프로퍼티들

프로퍼티 타입 설명
$categoryMap mapping of abstract column types (keys) to type categories (values).
$comment comment value of the column.
$db the current database connection. It is used mainly to escape strings safely when building the final column schema string.

보호된 프로퍼티들

프로퍼티 타입 설명
$after the column after which this column will be added.
$append SQL string to be appended to column schema definition.
$check the CHECK constraint for the column.
$default default value of the column.
$isFirst whether this column is to be inserted at the beginning of the table.
$isNotNull whether the column is or not nullable. If this is true, a NOT NULL constraint will be added. If this is false, a NULL constraint will be added.
$isUnique whether the column values should be unique. If this is true, a UNIQUE constraint will be added.
$isUnsigned whether the column values should be unsigned. If this is true, an UNSIGNED keyword will be added.
$length column size or precision definition. This is what goes into the parenthesis after the column type. This can be either a string, an integer or an array. If it is an array, the array values will be joined into a string separated by comma.
$type the column type definition such as INTEGER, VARCHAR, DATETIME, etc.

공개 메소드들

메소드 설명
__construct ( string $type, integer | string | array $length = null, Connection $db = null, array $config = [] ) Create a column schema builder instance giving the type and value precision.
__toString ( ) : string Builds the full string for the column's schema
after ( string $after ) Adds an AFTER constraint to the column.
append ( string $sql ) Specify additional SQL to be appended to schema string.
check ( string $check ) Sets a CHECK constraint for the column.
comment ( string $comment ) Specifies the comment for column.
defaultExpression ( string $default ) Specify the default SQL expression for the column.
defaultValue ( mixed $default ) Specify the default value for the column.
first ( ) Adds an FIRST constraint to the column.
notNull ( ) Adds a NOT NULL constraint to the column.
null ( ) Adds a NULL constraint to the column
unique ( ) Adds a UNIQUE constraint to the column.
unsigned ( ) Marks column as unsigned.

보호된 메소드들

메소드 설명
buildAfterString ( ) : string Builds the after constraint for the column. Defaults to unsupported.
buildAppendString ( ) : string Builds the custom string that's appended to column definition.
buildCheckString ( ) : string Builds the check constraint for the column.
buildCommentString ( ) : string Builds the comment specification for the column.
buildCompleteString ( string $format ) : string Returns the complete column definition from input format
buildDefaultString ( ) : string Builds the default value specification for the column.
buildFirstString ( ) : string Builds the first constraint for the column. Defaults to unsupported.
buildLengthString ( ) : string Builds the length/precision part of the column.
buildNotNullString ( ) : string Builds the not null constraint for the column.
buildUniqueString ( ) : string Builds the unique constraint for the column.
buildUnsignedString ( ) : string Builds the unsigned string for column. Defaults to unsupported.
getTypeCategory ( ) : string Returns the category of the column type.

메소드 상세

__construct() 공개 메소드

Create a column schema builder instance giving the type and value precision.
public __construct ( string $type, integer | string | array $length = null, Connection $db = null, array $config = [] )
$type string type of the column. See [[$type]].
$length integer | string | array length or precision of the column. See [[$length]].
$db Connection the current database connection. See [[$db]].
$config array name-value pairs that will be used to initialize the object properties

__toString() 공개 메소드

Builds the full string for the column's schema
public __toString ( ) : string
리턴 string

after() 공개 메소드

Note: MySQL, Oracle and Cubrid support only.
부터: 2.0.8
public after ( string $after )
$after string the column after which $this column will be added.

append() 공개 메소드

Specify additional SQL to be appended to schema string.
부터: 2.0.9
public append ( string $sql )
$sql string the SQL string to be appended.

buildAfterString() 보호된 메소드

Builds the after constraint for the column. Defaults to unsupported.
부터: 2.0.8
protected buildAfterString ( ) : string
리턴 string a string containing the AFTER constraint.

buildAppendString() 보호된 메소드

Builds the custom string that's appended to column definition.
부터: 2.0.9
protected buildAppendString ( ) : string
리턴 string custom string to append.

buildCheckString() 보호된 메소드

Builds the check constraint for the column.
protected buildCheckString ( ) : string
리턴 string a string containing the CHECK constraint.

buildCommentString() 보호된 메소드

Builds the comment specification for the column.
부터: 2.0.8
protected buildCommentString ( ) : string
리턴 string a string containing the COMMENT keyword and the comment itself

buildCompleteString() 보호된 메소드

Returns the complete column definition from input format
부터: 2.0.8
protected buildCompleteString ( string $format ) : string
$format string the format of the definition.
리턴 string a string containing the complete column definition.

buildDefaultString() 보호된 메소드

Builds the default value specification for the column.
protected buildDefaultString ( ) : string
리턴 string string with default value of column.

buildFirstString() 보호된 메소드

Builds the first constraint for the column. Defaults to unsupported.
부터: 2.0.8
protected buildFirstString ( ) : string
리턴 string a string containing the FIRST constraint.

buildLengthString() 보호된 메소드

Builds the length/precision part of the column.
protected buildLengthString ( ) : string
리턴 string

buildNotNullString() 보호된 메소드

Builds the not null constraint for the column.
protected buildNotNullString ( ) : string
리턴 string returns 'NOT NULL' if [[isNotNull]] is true, 'NULL' if [[isNotNull]] is false or an empty string otherwise.

buildUniqueString() 보호된 메소드

Builds the unique constraint for the column.
protected buildUniqueString ( ) : string
리턴 string returns string 'UNIQUE' if [[isUnique]] is true, otherwise it returns an empty string.

buildUnsignedString() 보호된 메소드

Builds the unsigned string for column. Defaults to unsupported.
부터: 2.0.7
protected buildUnsignedString ( ) : string
리턴 string a string containing UNSIGNED keyword.

check() 공개 메소드

Sets a CHECK constraint for the column.
public check ( string $check )
$check string the SQL of the `CHECK` constraint to be added.

comment() 공개 메소드

Specifies the comment for column.
부터: 2.0.8
public comment ( string $comment )
$comment string the comment

defaultExpression() 공개 메소드

Specify the default SQL expression for the column.
부터: 2.0.7
public defaultExpression ( string $default )
$default string the default value expression.

defaultValue() 공개 메소드

Specify the default value for the column.
public defaultValue ( mixed $default )
$default mixed the default value.

first() 공개 메소드

Note: MySQL, Oracle and Cubrid support only.
부터: 2.0.8
public first ( )

getTypeCategory() 보호된 메소드

Returns the category of the column type.
부터: 2.0.8
protected getTypeCategory ( ) : string
리턴 string a string containing the column type category name.

notNull() 공개 메소드

Adds a NOT NULL constraint to the column.
public notNull ( )

null() 공개 메소드

Adds a NULL constraint to the column
부터: 2.0.9
public null ( )

unique() 공개 메소드

Adds a UNIQUE constraint to the column.
public unique ( )

unsigned() 공개 메소드

Marks column as unsigned.
부터: 2.0.7
public unsigned ( )

프로퍼티 상세

$after 보호되어 있는 프로퍼티

the column after which this column will be added.
부터: 2.0.8
protected $after

$append 보호되어 있는 프로퍼티

SQL string to be appended to column schema definition.
부터: 2.0.9
protected $append

$categoryMap 공개적으로 프로퍼티

mapping of abstract column types (keys) to type categories (values).
부터: 2.0.8
public $categoryMap

$check 보호되어 있는 프로퍼티

the CHECK constraint for the column.
protected $check

$comment 공개적으로 프로퍼티

comment value of the column.
부터: 2.0.8
public $comment

$db 공개적으로 프로퍼티

the current database connection. It is used mainly to escape strings safely when building the final column schema string.
부터: 2.0.8
public $db

$default 보호되어 있는 프로퍼티

default value of the column.
protected $default

$isFirst 보호되어 있는 프로퍼티

whether this column is to be inserted at the beginning of the table.
부터: 2.0.8
protected $isFirst

$isNotNull 보호되어 있는 프로퍼티

whether the column is or not nullable. If this is true, a NOT NULL constraint will be added. If this is false, a NULL constraint will be added.
protected $isNotNull

$isUnique 보호되어 있는 프로퍼티

whether the column values should be unique. If this is true, a UNIQUE constraint will be added.
protected $isUnique

$isUnsigned 보호되어 있는 프로퍼티

whether the column values should be unsigned. If this is true, an UNSIGNED keyword will be added.
부터: 2.0.7
protected $isUnsigned

$length 보호되어 있는 프로퍼티

column size or precision definition. This is what goes into the parenthesis after the column type. This can be either a string, an integer or an array. If it is an array, the array values will be joined into a string separated by comma.
protected $length

$type 보호되어 있는 프로퍼티

the column type definition such as INTEGER, VARCHAR, DATETIME, etc.
protected $type