Constants

CASCADE

CASCADE = 'CASCADE'

RESTRICT

RESTRICT = 'RESTRICT'

SET_NULL

SET_NULL = 'SET NULL'

NO_ACTION

NO_ACTION = 'NO ACTION'

Properties

$columns

$columns : array

Type

array

$referencedColumns

$referencedColumns : array

Type

array

$onDelete

$onDelete : string

Type

string

$onUpdate

$onUpdate : string

Type

string

$constraint

$constraint : string|boolean

Type

string|boolean

Methods

setColumns()

setColumns(array|string  $columns) : \Phinx\Db\Table\ForeignKey

Sets the foreign key columns.

Parameters

array|string $columns

Returns

\Phinx\Db\Table\ForeignKey

getColumns()

getColumns() : array

Gets the foreign key columns.

Returns

array

getReferencedTable()

getReferencedTable() : \Phinx\Db\Table

Gets the foreign key referenced table.

Returns

\Phinx\Db\Table

setReferencedColumns()

setReferencedColumns(array  $referencedColumns) : \Phinx\Db\Table\ForeignKey

Sets the foreign key referenced columns.

Parameters

array $referencedColumns

Returns

\Phinx\Db\Table\ForeignKey

getReferencedColumns()

getReferencedColumns() : array

Gets the foreign key referenced columns.

Returns

array

setOnDelete()

setOnDelete(string  $onDelete) : \Phinx\Db\Table\ForeignKey

Sets ON DELETE action for the foreign key.

Parameters

string $onDelete

Returns

\Phinx\Db\Table\ForeignKey

getOnDelete()

getOnDelete() : string

Gets ON DELETE action for the foreign key.

Returns

string

getOnUpdate()

getOnUpdate() : string

Gets ON UPDATE action for the foreign key.

Returns

string

setOnUpdate()

setOnUpdate(string  $onUpdate) : \Phinx\Db\Table\ForeignKey

Sets ON UPDATE action for the foreign key.

Parameters

string $onUpdate

Returns

\Phinx\Db\Table\ForeignKey

setConstraint()

setConstraint(string  $constraint) : \Phinx\Db\Table\ForeignKey

Sets constraint for the foreign key.

Parameters

string $constraint

Returns

\Phinx\Db\Table\ForeignKey

getConstraint()

getConstraint() : string

Gets constraint name for the foreign key.

Returns

string

setOptions()

setOptions(array  $options) : \Phinx\Db\Table\ForeignKey

Utility method that maps an array of index options to this objects methods.

Parameters

array $options

Options

Throws

\RuntimeException
\InvalidArgumentException

Returns

\Phinx\Db\Table\ForeignKey

normalizeAction()

normalizeAction(string  $action) : string

From passed value checks if it's correct and fixes if needed

Parameters

string $action

Throws

\InvalidArgumentException

Returns

string