class Structure

internal  
 

Provides database structure metadata with caching.

Properties

protected $structure
protected $isRebuilt

Methods

__construct(Engine $engine, Cache $cache)

No description

array
getTables()

No description

array
getColumns(string $table)

No description

string|array|null
getPrimaryKey(string $table)

No description

string|null
getPrimaryAutoincrementKey(string $table)

Returns the name of the autoincrement primary key column, or null if none exists.

string|null
getPrimaryKeySequence(string $table)

Returns the sequence name for the primary key column, or null if not applicable.

array
getHasManyReference(string $table)

No description

array
getBelongsToReference(string $table)

No description

void
rebuild()

Rebuilds structure cache.

bool
isRebuilt()

Checks whether the structure has been rebuilt from the database during this request.

void
needStructure()

Ensures the structure is loaded, from cache or from the database.

array
loadStructure()

Loads complete structure from database.

string|array|null
analyzePrimaryKey(array $columns)

No description

void
analyzeForeignKeys(array $structure, string $table)

No description

string
resolveFQTableName(string $table)

Returns normalized table name.

Details

at line 25
__construct(Engine $engine, Cache $cache)

No description

Parameters

Engine $engine
Cache $cache

at line 33
array getTables()

No description

Return Value

array

at line 40
array getColumns(string $table)

No description

Parameters

string $table

Return Value

array

at line 52
string|array|null getPrimaryKey(string $table)

No description

Parameters

string $table

Return Value

string|array|null

at line 63
string|null getPrimaryAutoincrementKey(string $table)

Returns the name of the autoincrement primary key column, or null if none exists.

Parameters

string $table

Return Value

string|null

at line 96
string|null getPrimaryKeySequence(string $table)

Returns the sequence name for the primary key column, or null if not applicable.

Parameters

string $table

Return Value

string|null

at line 122
array getHasManyReference(string $table)

No description

Parameters

string $table

Return Value

array

referencing table name => list of referencing columns

at line 131
array getBelongsToReference(string $table)

No description

Parameters

string $table

Return Value

array

local column name => referenced table name

at line 142
void rebuild()

Rebuilds structure cache.

Return Value

void

at line 152
bool isRebuilt()

Checks whether the structure has been rebuilt from the database during this request.

Return Value

bool

at line 161
protected void needStructure()

Ensures the structure is loaded, from cache or from the database.

Return Value

void

at line 175
protected array loadStructure()

Loads complete structure from database.

Return Value

array

at line 212
protected string|array|null analyzePrimaryKey(array $columns)

No description

Parameters

array $columns

Return Value

string|array|null

at line 232
protected void analyzeForeignKeys(array $structure, string $table)

No description

Parameters

array $structure
string $table

Return Value

void

at line 254
protected string resolveFQTableName(string $table)

Returns normalized table name.

Parameters

string $table

Return Value

string