class Structure implements IStructure

Cached reflection of database structure.

Properties

protected $connection
protected $cache
protected $structure
protected $isRebuilt

Methods

__construct(Connection $connection, Storage $cacheStorage)

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 autoincrement primary key name.

string|null
getPrimaryKeySequence(string $table)

Returns table primary key sequence.

array|null
getHasManyReference(string $table, string|null $targetTable = null)

Returns hasMany reference.

array|null
getBelongsToReference(string $table, string|null $column = null)

Returns belongsTo reference.

void
rebuild()

Rebuilds database structure cache.

bool
isRebuilt()

Returns true if database cached structure has been rebuilt.

void
needStructure()

No description

array
loadStructure()

No description

string|array|null
analyzePrimaryKey(array $columns)

No description

void
analyzeForeignKeys(array $structure, string $table)

No description

string
resolveFQTableName(string $table)

No description

Details

at line 26
__construct(Connection $connection, Storage $cacheStorage)

No description

Parameters

Connection $connection
Storage $cacheStorage

at line 34
array getTables()

No description

Return Value

array

at line 42
array getColumns(string $table)

No description

Parameters

string $table

Return Value

array

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

No description

Parameters

string $table

Return Value

string|array|null

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

Returns autoincrement primary key name.

Parameters

string $table

Return Value

string|null

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

Returns table primary key sequence.

Parameters

string $table

Return Value

string|null

at line 117
array|null getHasManyReference(string $table, string|null $targetTable = null)

Returns hasMany reference.

If a targetTable is not provided, returns references for all tables.

Parameters

string $table
string|null $targetTable

Return Value

array|null

at line 138
array|null getBelongsToReference(string $table, string|null $column = null)

Returns belongsTo reference.

If a column is not provided, returns references for all columns.

Parameters

string $table
string|null $column

Return Value

array|null

at line 155
void rebuild()

Rebuilds database structure cache.

Return Value

void

at line 162
bool isRebuilt()

Returns true if database cached structure has been rebuilt.

Return Value

bool

at line 168
protected void needStructure()

No description

Return Value

void

at line 178
protected array loadStructure()

No description

Return Value

array

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

No description

Parameters

array $columns

Return Value

string|array|null

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

No description

Parameters

array $structure
string $table

Return Value

void

at line 252
protected string resolveFQTableName(string $table)

No description

Parameters

string $table

Return Value

string