class Structure implements IStructure

Cached reflection of database structure.

Properties

protected Connection $connection
protected Cache $cache
protected array $structure
protected bool $isRebuilt

Methods

__construct(Connection $connection, IStorage $cacheStorage)

No description

array
getTables()

Returns tables list.

array
getColumns($table)

Returns table columns list.

string|array|null
getPrimaryKey($table)

Returns table primary key.

getPrimaryAutoincrementKey($table)

No description

string|null
getPrimaryKeySequence($table)

Returns table primary key sequence.

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

Returns hasMany reference.

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

Returns belongsTo reference.

void
rebuild()

Rebuilds database structure cache.

bool
isRebuilt()

Returns true if database cached structure has been rebuilt.

needStructure()

No description

loadStructure()

No description

analyzePrimaryKey(array $columns)

No description

analyzeForeignKeys($structure, $table)

No description

resolveFQTableName($table)

No description

Details

at line 33
__construct(Connection $connection, IStorage $cacheStorage)

No description

Parameters

Connection $connection
IStorage $cacheStorage

at line 40
array getTables()

Returns tables list.

Return Value

array

at line 47
array getColumns($table)

Returns table columns list.

Parameters

$table

Return Value

array

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

Returns table primary key.

Parameters

$table

Return Value

string|array|null

at line 69
getPrimaryAutoincrementKey($table)

No description

Parameters

$table

at line 98
string|null getPrimaryKeySequence($table)

Returns table primary key sequence.

Parameters

$table

Return Value

string|null

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

Returns hasMany reference.

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

Parameters

$table
$targetTable

Return Value

array|null

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

Returns belongsTo reference.

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

Parameters

$table
$column

Return Value

array|null

at line 168
void rebuild()

Rebuilds database structure cache.

Return Value

void

at line 175
bool isRebuilt()

Returns true if database cached structure has been rebuilt.

Return Value

bool

at line 181
protected needStructure()

No description

at line 194
loadStructure()

internal  
 

No description

at line 231
protected analyzePrimaryKey(array $columns)

No description

Parameters

array $columns

at line 250
protected analyzeForeignKeys($structure, $table)

No description

Parameters

$structure
$table

at line 266
protected resolveFQTableName($table)

No description

Parameters

$table

Traits

SmartObject