Documentation

TableDefinition extends TableDefinition
in package

Tags
author

Jan Schneider jan@horde.org

category

Horde

copyright

2013-2021 Horde LLC

license

http://www.horde.org/licenses/bsd

since

Horde_Db 2.1.0

subpackage

Adapter

Table of Contents

$base  : mixed
$columns  : mixed
$columntypes  : mixed
$createTrigger  : mixed
$name  : mixed
$options  : array<string|int, mixed>
$primaryKey  : mixed
__call()  : mixed
Use __call to provide shorthand column creation ($this->integer(), etc.)
__construct()  : mixed
Constructor.
__toString()  : mixed
belongsTo()  : mixed
Add one or several references to foreign keys
column()  : TableDefinition
Adds a new column to the table definition.
end()  : mixed
Wrap up table creation block & create the table
getIterator()  : mixed
getName()  : string
getOptions()  : array<string|int, mixed>
offsetExists()  : bool
ArrayAccess: Check if the given offset exists
offsetGet()  : object
ArrayAccess: Return the value for the given offset.
offsetSet()  : mixed
ArrayAccess: Set value for given offset
offsetUnset()  : mixed
ArrayAccess: remove element
primaryKey()  : mixed
references()  : mixed
Alias for the belongsTo() method
timestamps()  : mixed
Adds created_at and updated_at columns to the table.
toSql()  : string
Returns a String whose contents are the column definitions concatenated together. This string can then be pre and appended to to generate the final SQL to create the table.
native()  : mixed
Get the types

Properties

$columntypes

protected mixed $columntypes = array('string', 'text', 'integer', 'float', 'datetime', 'timestamp', 'time', 'date', 'binary', 'boolean')

Methods

__call()

Use __call to provide shorthand column creation ($this->integer(), etc.)

public __call(mixed $method, mixed $arguments) : mixed
Parameters
$method : mixed
$arguments : mixed
Return values
mixed

__construct()

Constructor.

public __construct(string $name, Schema $base[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$name : string
$base : Schema
$options : array<string|int, mixed> = []
Return values
mixed

belongsTo()

Add one or several references to foreign keys

public belongsTo(mixed $columns) : mixed

This method returns self.

Parameters
$columns : mixed
Return values
mixed

column()

Adds a new column to the table definition.

public column(mixed $name, string $type[, array<string|int, mixed> $options = [] ]) : TableDefinition
Parameters
$name : mixed
$type : string

Column type, one of: autoincrementKey, string, text, integer, float, datetime, timestamp, time, date, binary, boolean.

$options : array<string|int, mixed> = []

Column options:

  • limit: (integer) Maximum column length (string, text, binary or integer columns only)
  • default: (mixed) The column's default value. You cannot explicitly set the default value to NULL. Simply leave off this option if you want a NULL default value.
  • null: (boolean) Whether NULL values are allowed in the column.
  • precision: (integer) The number precision (float columns only).
  • scale: (integer) The number scaling (float columns only).
  • unsigned: (boolean) Whether the column is an unsigned number (integer columns only).
  • autoincrement: (boolean) Whether the column is an autoincrement column. Restrictions are RDMS specific.
Return values
TableDefinition

This object.

end()

Wrap up table creation block & create the table

public end() : mixed
Return values
mixed

getOptions()

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

offsetExists()

ArrayAccess: Check if the given offset exists

public offsetExists(int $offset) : bool
Parameters
$offset : int
Return values
bool

offsetGet()

ArrayAccess: Return the value for the given offset.

public offsetGet(int $offset) : object
Parameters
$offset : int
Return values
object

offsetSet()

ArrayAccess: Set value for given offset

public offsetSet(int $offset, mixed $value) : mixed
Parameters
$offset : int
$value : mixed
Return values
mixed

offsetUnset()

ArrayAccess: remove element

public offsetUnset(int $offset) : mixed
Parameters
$offset : int
Return values
mixed

primaryKey()

public primaryKey(string $name) : mixed
Parameters
$name : string
Return values
mixed

references()

Alias for the belongsTo() method

public references(mixed $columns) : mixed

This method returns self.

Parameters
$columns : mixed
Return values
mixed

timestamps()

Adds created_at and updated_at columns to the table.

public timestamps() : mixed
Return values
mixed

toSql()

Returns a String whose contents are the column definitions concatenated together. This string can then be pre and appended to to generate the final SQL to create the table.

public toSql() : string
Return values
string

native()

Get the types

protected native() : mixed
Return values
mixed

Search results