StaticConventions
class StaticConventions implements Conventions
Conventions based on static definition.
Properties
protected | $primary | ||
protected | $foreign | ||
protected | $table |
Methods
__construct(string $primary = 'id', string $foreign = '%s_id', string $table = '%s')
Create static conventional structure.
string|array|null
getPrimary(string $table)
Returns primary key for table.
array|null
getHasManyReference(string $table, string $key)
Returns referenced table & referenced column.
array|null
getBelongsToReference(string $table, string $key)
Returns referenced table & referencing column.
string
getColumnFromTable(string $name)
No description
Details
at line 36
__construct(string $primary = 'id', string $foreign = '%s_id', string $table = '%s')
Create static conventional structure.
at line 44
string|array|null
getPrimary(string $table)
Returns primary key for table.
at line 50
array|null
getHasManyReference(string $table, string $key)
Returns referenced table & referenced column.
Example: (author, book) returns [book, author_id]
at line 60
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]
at line 70
protected string
getColumnFromTable(string $name)
No description
Traits
Strict class for better experience.