public getTableSchemas ( string $schema = '', boolean $refresh = false ) : yii\db\TableSchema[] | ||
$schema | string | the schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | boolean | whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
return | yii\db\TableSchema[] | the metadata for all tables in the database. Each array element is an instance of [[TableSchema]] or its child class. |
public function getTableSchemas($schema = '', $refresh = false)
{
$tables = [];
foreach ($this->getTableNames($schema, $refresh) as $name) {
if ($schema !== '') {
$name = $schema . '.' . $name;
}
if (($table = $this->getTableSchema($name, $refresh)) !== null) {
$tables[] = $table;
}
}
return $tables;
}