class DiscoveredConventions implements IConventions

Conventions based on database structure.

Properties

protected IStructure $structure

Methods

__construct(IStructure $structure)

No description

string|string[]|null
getPrimary(string $table)

Returns primary key for table.

array|null
getHasManyReference(string $nsTable, string $key)

Returns referenced table & referenced column.

array|null
getBelongsToReference(string $table, string $key)

Returns referenced table & referencing column.

Details

at line 25
__construct(IStructure $structure)

No description

Parameters

IStructure $structure

at line 31
string|string[]|null getPrimary(string $table)

Returns primary key for table.

Parameters

string $table

Return Value

string|string[]|null

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

Returns referenced table & referenced column.

Example: (author, book) returns [book, author_id]

Parameters

string $nsTable
string $key

Return Value

array|null

[referenced table, referenced column]

Exceptions

AmbiguousReferenceKeyException

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

Returns referenced table & referencing column.

Example (book, author) returns [author, author_id] (book, translator) returns [author, translator_id]

Parameters

string $table
string $key

Return Value

array|null

[referenced table, referencing column]