yii\db\ActiveRecord::getTableSchema PHP Method

getTableSchema() public static method

Returns the schema information of the DB table associated with this AR class.
public static getTableSchema ( ) : yii\db\TableSchema
return yii\db\TableSchema the schema information of the DB table associated with this AR class.
    public static function getTableSchema()
    {
        $tableSchema = static::getDb()->getSchema()->getTableSchema(static::tableName());
        if ($tableSchema === null) {
            throw new InvalidConfigException('The table does not exist: ' . static::tableName());
        }
        return $tableSchema;
    }

Usage Example

 public static function getTableSchema()
 {
     $class = get_called_class();
     if (!isset(self::$getTableSchemaCache[$class])) {
         self::$getTableSchemaCache[$class] = parent::getTableSchema();
     }
     return self::$getTableSchemaCache[$class];
 }
All Usage Examples Of yii\db\ActiveRecord::getTableSchema