class Structure extends Object 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.

string|null
getPrimaryKeySequence($table)

Returns table primary key sequence.

mixed
getHasManyReference($table, $targetTable = NULL)

Returns hasMany reference.

mixed
getBelongsToReference($table, $column = NULL)

Returns belongsTo reference.

mixed
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 31
__construct(Connection $connection, IStorage $cacheStorage)

No description

Parameters

Connection $connection
IStorage $cacheStorage

at line 38
array getTables()

Returns tables list.

Return Value

array

at line 45
array getColumns($table)

Returns table columns list.

Parameters

$table

Return Value

array

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

Returns table primary key.

Parameters

$table

Return Value

string|array|null

at line 67
string|null getPrimaryKeySequence($table)

Returns table primary key sequence.

Parameters

$table

Return Value

string|null

at line 91
mixed getHasManyReference($table, $targetTable = NULL)

Returns hasMany reference.

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

Parameters

$table
$targetTable

Return Value

mixed

at line 115
mixed getBelongsToReference($table, $column = NULL)

Returns belongsTo reference.

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

Parameters

$table
$column

Return Value

mixed

at line 136
mixed rebuild()

Rebuilds database structure cache.

Return Value

mixed

at line 143
bool isRebuilt()

Returns true if database cached structure has been rebuilt.

Return Value

bool

at line 149
protected needStructure()

No description

at line 162
loadStructure()

internal  
 

No description

at line 199
protected analyzePrimaryKey(array $columns)

No description

Parameters

array $columns

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

No description

Parameters

$structure
$table

at line 234
protected resolveFQTableName($table)

No description

Parameters

$table