Constants

FIRST

FIRST = 'FIRST '

Methods

clearInstance()

clearInstance(mixed  $key) : mixed

Parameters

mixed $key

Returns

mixed —

clearInstancePool()

clearInstancePool() : mixed

Clears the instance pool.

Returns

mixed —

get()

get(string  $name, int  $db = 1) : self

Parameters

string $name
int $db

Returns

self —

exists()

exists() : bool

Returns

bool —

getName()

getName() : string

Returns

string —

setName()

setName(string  $name) : $this

Parameters

string $name

Returns

$this —

hasColumn()

hasColumn(string  $name) : bool

Parameters

string $name

Returns

bool —

getColumn()

getColumn(string  $name) : null|\rex_sql_column

Parameters

string $name

Returns

null|\rex_sql_column —

getColumns()

getColumns() : \rex_sql_column[]

Returns

\rex_sql_column[] —

addColumn()

addColumn(\rex_sql_column  $column, null|string  $afterColumn = null) : $this

Parameters

\rex_sql_column $column
null|string $afterColumn

Column name or rex_sql_table::FIRST

Returns

$this —

ensureColumn()

ensureColumn(\rex_sql_column  $column, null|string  $afterColumn = null) : $this

Parameters

\rex_sql_column $column
null|string $afterColumn

Column name or rex_sql_table::FIRST

Returns

$this —

ensurePrimaryIdColumn()

ensurePrimaryIdColumn() : $this

Returns

$this —

ensureGlobalColumns()

ensureGlobalColumns(null|string  $afterColumn = null) : $this

Parameters

null|string $afterColumn

Column name or rex_sql_table::FIRST

Returns

$this —

renameColumn()

renameColumn(string  $oldName, string  $newName) : $this

Parameters

string $oldName
string $newName

Throws

\rex_exception

Returns

$this —

removeColumn()

removeColumn(string  $name) : $this

Parameters

string $name

Returns

$this —

getPrimaryKey()

getPrimaryKey() : null|string[]

Returns

null|string[] —

Column names

setPrimaryKey()

setPrimaryKey(null|string|string[]  $columns) : $this

Parameters

null|string|string[] $columns

Column name(s)

Throws

\rex_exception

Returns

$this —

hasIndex()

hasIndex(string  $name) : bool

Parameters

string $name

Returns

bool —

getIndex()

getIndex(string  $name) : null|\rex_sql_index

Parameters

string $name

Returns

null|\rex_sql_index —

getIndexes()

getIndexes() : \rex_sql_index[]

Returns

\rex_sql_index[] —

addIndex()

addIndex(\rex_sql_index  $index) : $this

Parameters

\rex_sql_index $index

Returns

$this —

ensureIndex()

ensureIndex(\rex_sql_index  $index) : $this

Parameters

\rex_sql_index $index

Returns

$this —

renameIndex()

renameIndex(string  $oldName, string  $newName) : $this

Parameters

string $oldName
string $newName

Throws

\rex_exception

Returns

$this —

removeIndex()

removeIndex(string  $name) : $this

Parameters

string $name

Returns

$this —

hasForeignKey()

hasForeignKey(string  $name) : bool

Parameters

string $name

Returns

bool —

getForeignKey()

getForeignKey(string  $name) : null|\rex_sql_foreign_key

Parameters

string $name

Returns

null|\rex_sql_foreign_key —

getForeignKeys()

getForeignKeys() : \rex_sql_foreign_key[]

Returns

\rex_sql_foreign_key[] —

addForeignKey()

addForeignKey(\rex_sql_foreign_key  $foreignKey) : $this

Parameters

\rex_sql_foreign_key $foreignKey

Returns

$this —

ensureForeignKey()

ensureForeignKey(\rex_sql_foreign_key  $foreignKey) : $this

Parameters

\rex_sql_foreign_key $foreignKey

Returns

$this —

renameForeignKey()

renameForeignKey(string  $oldName, string  $newName) : $this

Parameters

string $oldName
string $newName

Throws

\rex_exception

Returns

$this —

removeForeignKey()

removeForeignKey(string  $name) : $this

Parameters

string $name

Returns

$this —

ensure()

ensure() : mixed

Ensures that the table exists with the given definition.

Returns

mixed —

drop()

drop() : mixed

Drops the table if it exists.

Returns

mixed —

create()

create() : mixed

Creates the table.

Throws

\rex_exception

Returns

mixed —

alter()

alter() : mixed

Alters the table.

Throws

\rex_exception

Returns

mixed —

addInstance()

addInstance(mixed  $key, self  $instance) : mixed

Adds an instance.

Parameters

mixed $key

Key

self $instance

Instance

Returns

mixed —

hasInstance()

hasInstance(mixed  $key) : bool

Checks whether an instance exists for the given key.

Parameters

mixed $key

Key

Returns

bool —

getInstance()

getInstance(mixed  $key, callable  $createCallback = null) : null|static

Returns the instance for the given key.

If the instance does not exist it will be created by calling the $createCallback

Parameters

mixed $key

Key

callable $createCallback

Callback, will be called to create a new instance

Returns

null|static —