mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 22:09:48 +08:00
@@ -291,12 +291,15 @@ class ActiveRecord extends BaseActiveRecord
|
||||
*/
|
||||
public static function getTableSchema()
|
||||
{
|
||||
$schema = static::getDb()->getSchema()->getTableSchema(static::tableName());
|
||||
if ($schema !== null) {
|
||||
return $schema;
|
||||
} else {
|
||||
$schema = static::getDb()
|
||||
->getSchema()
|
||||
->getTableSchema(static::tableName());
|
||||
|
||||
if ($schema === null) {
|
||||
throw new InvalidConfigException('The table does not exist: ' . static::tableName());
|
||||
}
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -104,7 +104,7 @@ abstract class Schema extends Object
|
||||
/**
|
||||
* Loads the metadata for the specified table.
|
||||
* @param string $name table name
|
||||
* @return TableSchema DBMS-dependent table metadata, null if the table does not exist.
|
||||
* @return null|TableSchema DBMS-dependent table metadata, null if the table does not exist.
|
||||
*/
|
||||
abstract protected function loadTableSchema($name);
|
||||
|
||||
@@ -112,7 +112,7 @@ abstract class Schema extends Object
|
||||
* Obtains the metadata for the named table.
|
||||
* @param string $name table name. The table name may contain schema name if any. Do not quote the table name.
|
||||
* @param boolean $refresh whether to reload the table schema even if it is found in the cache.
|
||||
* @return TableSchema table metadata. Null if the named table does not exist.
|
||||
* @return null|TableSchema table metadata. Null if the named table does not exist.
|
||||
*/
|
||||
public function getTableSchema($name, $refresh = false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user