You are here

function schema_dbobject in Schema 8

Same name and namespace in other branches
  1. 7 schema.module \schema_dbobject()

Fetch a schema engine class instance for a given database connection.

Parameters

string $connection: A database connection key, defaults to the schema_database_connection variable, which itself defaults to 'default'.

Return value

Drupal\schema\DatabaseSchemaInspectionInterface A schema engine class set to the given connection.

2 calls to schema_dbobject()
drush_schema_fix in ./schema.drush.inc
Implements drush_COMMANDFILE_COMMANDNAME().
schema_compare_schemas in ./schema.module
Compares two complete schemas.

File

./schema.module, line 69
The Schema module provides functionality built on the Schema API.

Code

function schema_dbobject($connection = NULL) {
  if (!isset($connection)) {
    $connection = \Drupal::config('schema.settings')
      ->get('schema_database_connection');
  }
  if ($class = schema_get_connection_engine_class($connection)) {
    return new $class(Database::getConnection('default', $connection));
  }
}