class DiscoveredConventions implements IConventions

Conventions based on database structure.

Properties

protected IStructure $structure

Methods

__construct(IStructure $structure)

No description

string|array|null
getPrimary($table)

Returns primary key for table.

array|null
getHasManyReference($nsTable, $key)

Returns referenced table & referenced column.

array|null
getBelongsToReference($table, $key)

Returns referenced table & referencing column.

Details

at line 23
__construct(IStructure $structure)

No description

Parameters

IStructure $structure

at line 29
string|array|null getPrimary($table)

Returns primary key for table.

Parameters

$table

Return Value

string|array|null

at line 35
array|null getHasManyReference($nsTable, $key)

Returns referenced table & referenced column.

Example: (author, book) returns array(book, author_id)

Parameters

$nsTable
$key

Return Value

array|null

array(referenced table, referenced column)

Exceptions

AmbiguousReferenceKeyException

at line 84
array|null getBelongsToReference($table, $key)

Returns referenced table & referencing column.

Example (book, author) returns array(author, author_id) (book, translator) returns array(author, translator_id)

Parameters

$table
$key

Return Value

array|null

array(referenced table, referencing column)