You are here

final public static function Database::setActiveConnection in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::setActiveConnection()

Sets the active connection to the specified key.

Return value

string|null The previous database connection key.

4 calls to Database::setActiveConnection()
DbImportCommand::runScript in core/lib/Drupal/Core/Command/DbImportCommand.php
Run the database script.
db_set_active in core/includes/database.inc
Sets a new active database.
MigrateDrupalTestBase::loadFixture in core/modules/migrate_drupal/src/Tests/MigrateDrupalTestBase.php
Loads a database fixture into the source database connection.
SchemaTest::testFindTables in core/modules/system/src/Tests/Database/SchemaTest.php
Tests the findTables() method.

File

core/lib/Drupal/Core/Database/Database.php, line 196
Contains \Drupal\Core\Database\Database.

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

public static final function setActiveConnection($key = 'default') {
  if (!empty(self::$databaseInfo[$key])) {
    $old_key = self::$activeKey;
    self::$activeKey = $key;
    return $old_key;
  }
}