function Database::getDatabaseDriverNamespace

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::getDatabaseDriverNamespace()

Gets the PHP namespace of a database driver from the connection info.

Parameters

array $connection_info: The database connection information, as defined in settings.php. The structure of this array depends on the database driver it is connecting to.

Return value

string The PHP namespace of the driver's database.

Deprecated

in drupal:9.1.0 and is removed from drupal:10.0.0. There is no replacement as $connection_info['namespace'] is always set.

See also

https://www.drupal.org/node/3127769

File

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

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

protected static function getDatabaseDriverNamespace(array $connection_info) {
    @trigger_error(__METHOD__ . " is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. There is no replacement as \$connection_info['namespace'] is always set. See https://www.drupal.org/node/3127769.", E_USER_DEPRECATED);
    if (isset($connection_info['namespace'])) {
        return $connection_info['namespace'];
    }
    // Fallback for when the namespace is not provided in settings.php.
    return 'Drupal\\' . $connection_info['driver'] . '\\Driver\\Database\\' . $connection_info['driver'];
}

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