Table extends BaseObject
Class BaseObject Base class for all schema objects such as tables, columns, indexes, etc.
Table of Contents
Properties
- $body : mixed
- $checkExists : mixed
- $columns : Collection
- $constraints : Collection
- $indexes : Collection
- $name : mixed
- $parent : BaseObject|null
- $triggers : Collection
Methods
- __construct() : mixed
- compareName() : int
- Compares name of the table with given.
- create() : Table
- Creates table object from tokens.
- createColumn() : Table
- Creates column object from tokens.
- createConstraint() : Table
- Creates constraint object from tokens.
- createIndex() : Table
- Creates index object from tokens.
- createTrigger() : Table
- Creates trigger object from tokens.
- getCompareName() : string
- Returns "normalized" name of the table.
- getCreateDdl() : array<string|int, mixed>|string
- Return DDL for table creation.
- getDropDdl() : array<string|int, mixed>|string
- Return DDL for table destruction.
- getLowercasedName() : string
- Returns "lowercased" name of the object.
- getModifyDdl() : array<string|int, mixed>|string
- Return DDL or commentary for object modification.
- getUnquotedName() : array<string|int, mixed>|string
- Returns "unquoted" name of the object.
- modifyColumn() : Table
- Alters column object from tokens.
- setBody() : BaseObject
- Sets source code for object.
- setParent() : BaseObject
- Sets parent for object.
Properties
$body
public
mixed
$body
= ''
$checkExists
public
mixed
$checkExists
= false
$columns
public
Collection
$columns
= null
$constraints
public
Collection
$constraints
= null
$indexes
public
Collection
$indexes
= null
$name
public
mixed
$name
= ''
$parent
public
BaseObject|null
$parent
= null
$triggers
public
Collection
$triggers
= null
Methods
__construct()
public
__construct([string $name = '' ]) : mixed
Parameters
- $name : string = ''
-
Index name.
compareName()
Compares name of the table with given.
public
final compareName(string $name) : int
If name has no quotes when comparison is case insensitive.
Parameters
- $name : string
-
Table name to compare.
Tags
Return values
intcreate()
Creates table object from tokens.
public
static create(Tokenizer $tokenizer) : Table
Current position should point to the name of the sequence or 'if not exists' clause.
Parameters
- $tokenizer : Tokenizer
-
Tokens collection.
Tags
Return values
TablecreateColumn()
Creates column object from tokens.
public
createColumn(Tokenizer $tokenizer) : Table
And registers column in the table column registry.
Parameters
- $tokenizer : Tokenizer
-
Tokens collection.
Tags
Return values
TablecreateConstraint()
Creates constraint object from tokens.
public
createConstraint(Tokenizer $tokenizer[, string $constraintName = '' ]) : Table
And registers constraint in the table constraint registry.
Parameters
- $tokenizer : Tokenizer
-
Tokens collection.
- $constraintName : string = ''
-
Optional name of the constraint.
Tags
Return values
TablecreateIndex()
Creates index object from tokens.
public
createIndex(Tokenizer $tokenizer[, bool $unique = false ][, bool $fulltext = false ][, string $indexName = '' ]) : Table
And registers index in the table index registry.
Parameters
- $tokenizer : Tokenizer
-
Tokens collection.
- $unique : bool = false
-
Uniqueness flag.
- $fulltext : bool = false
-
Fulltext flag.
- $indexName : string = ''
-
Optional name of the index.
Tags
Return values
TablecreateTrigger()
Creates trigger object from tokens.
public
createTrigger(Tokenizer $tokenizer) : Table
And registers trigger in the table trigger registry.
Parameters
- $tokenizer : Tokenizer
-
Tokens collection.
Tags
Return values
TablegetCompareName()
Returns "normalized" name of the table.
public
final static getCompareName(string $name) : string
If name is not quoted then it made uppercase.
Parameters
- $name : string
-
Table name.
Return values
stringgetCreateDdl()
Return DDL for table creation.
public
getCreateDdl([string $dbType = '' ]) : array<string|int, mixed>|string
Parameters
- $dbType : string = ''
-
Database type (MYSQL, ORACLE or MSSQL).
Return values
array<string|int, mixed>|stringgetDropDdl()
Return DDL for table destruction.
public
getDropDdl([string $dbType = '' ]) : array<string|int, mixed>|string
Parameters
- $dbType : string = ''
-
Database type (MYSQL, ORACLE or MSSQL).
Return values
array<string|int, mixed>|stringgetLowercasedName()
Returns "lowercased" name of the object.
public
final getLowercasedName() : string
If name is not quoted then it made lowercase.
Return values
stringgetModifyDdl()
Return DDL or commentary for object modification.
public
getModifyDdl(BaseObject $target[, string $dbType = '' ]) : array<string|int, mixed>|string
Parameters
- $target : BaseObject
-
Target object.
- $dbType : string = ''
-
Database type.
Return values
array<string|int, mixed>|stringgetUnquotedName()
Returns "unquoted" name of the object.
public
final getUnquotedName([array<string|int, mixed>|string $name = null ]) : array<string|int, mixed>|string
Parameters
- $name : array<string|int, mixed>|string = null
-
Name or array of names to unquote.
Return values
array<string|int, mixed>|stringmodifyColumn()
Alters column object from tokens.
public
modifyColumn(Tokenizer $tokenizer) : Table
Parameters
- $tokenizer : Tokenizer
-
Tokens collection.
Tags
Return values
TablesetBody()
Sets source code for object.
public
setBody(string $body) : BaseObject
Parameters
- $body : string
-
The body.
Return values
BaseObjectsetParent()
Sets parent for object.
public
setParent([BaseObject $parent = null ]) : BaseObject
For example Table for Column.
Parameters
- $parent : BaseObject = null
-
Parent object.