function Database::setMultipleConnectionInfo

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::setMultipleConnectionInfo()
  2. 10 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::setMultipleConnectionInfo()
  3. 11.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::setMultipleConnectionInfo()

Sets connection information for multiple databases.

Parameters

array $databases: A multi-dimensional array specifying database connection parameters, as defined in settings.php.

\Composer\Autoload\ClassLoader $class_loader: The class loader. Used for adding the database driver(s) to the autoloader if $databases[$key][$target]['autoload'] is set.

string $app_root: The app root.

1 call to Database::setMultipleConnectionInfo()
Settings::initialize in core/lib/Drupal/Core/Site/Settings.php
Bootstraps settings.php and the Settings singleton.

File

core/lib/Drupal/Core/Database/Database.php, line 380

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

public static final function setMultipleConnectionInfo(array $databases, $class_loader = NULL, $app_root = NULL) {
    foreach ($databases as $key => $targets) {
        foreach ($targets as $target => $info) {
            self::addConnectionInfo($key, $target, $info, $class_loader, $app_root);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.