You are here

protected function MigrationConfigurationTrait::getConnection in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/src/MigrationConfigurationTrait.php \Drupal\migrate_drupal\MigrationConfigurationTrait::getConnection()
  2. 9 core/modules/migrate_drupal/src/MigrationConfigurationTrait.php \Drupal\migrate_drupal\MigrationConfigurationTrait::getConnection()

Gets the database connection for the source Drupal database.

Parameters

array $database: Database array representing the source Drupal database.

Return value

\Drupal\Core\Database\Connection The database connection for the source Drupal database.

1 call to MigrationConfigurationTrait::getConnection()
CredentialForm::validateForm in core/modules/migrate_drupal_ui/src/Form/CredentialForm.php
Form validation handler.

File

core/modules/migrate_drupal/src/MigrationConfigurationTrait.php, line 53

Class

MigrationConfigurationTrait
Configures the appropriate migrations for a given source Drupal database.

Namespace

Drupal\migrate_drupal

Code

protected function getConnection(array $database) {

  // Set up the connection.
  Database::addConnectionInfo('upgrade', 'default', $database);
  $connection = Database::getConnection('default', 'upgrade');
  return $connection;
}