public function loadStructure()
{
$driver = $this->connection->getSupplementalDriver();
$structure = [];
$structure['tables'] = $driver->getTables();
foreach ($structure['tables'] as $tablePair) {
if (isset($tablePair['fullName'])) {
$table = $tablePair['fullName'];
$structure['aliases'][strtolower($tablePair['name'])] = strtolower($table);
} else {
$table = $tablePair['name'];
}
$structure['columns'][strtolower($table)] = $columns = $driver->getColumns($table);
if (!$tablePair['view']) {
$structure['primary'][strtolower($table)] = $this->analyzePrimaryKey($columns);
$this->analyzeForeignKeys($structure, $table);
}
}
if (isset($structure['hasMany'])) {
foreach ($structure['hasMany'] as &$table) {
uksort($table, function ($a, $b) {
return strlen($a) - strlen($b);
});
}
}
$this->isRebuilt = TRUE;
return $structure;
}