function Connection::createUrlFromConnectionOptions
Creates a URL from an array of database connection options.
@internal This method should only be called from \Drupal\Core\Database\Database::getConnectionInfoAsUrl().
Parameters
array $connection_options: The array of connection options for a database connection. An additional key of 'module' is added by Database::getConnectionInfoAsUrl() for drivers provided my contributed or custom modules for convenience.
Return value
string The connection info as a URL.
Overrides Connection::createUrlFromConnectionOptions
File
- 
              core/modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php, line 526 
Class
- Connection
- SQLite implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\sqlite\Driver\Database\sqliteCode
public static function createUrlFromConnectionOptions(array $connection_options) {
  if (!isset($connection_options['driver'], $connection_options['database'])) {
    throw new \InvalidArgumentException("As a minimum, the connection options array must contain at least the 'driver' and 'database' keys");
  }
  $db_url = 'sqlite://localhost/' . $connection_options['database'] . '?module=sqlite';
  if (isset($connection_options['prefix']) && $connection_options['prefix'] !== '') {
    $db_url .= '#' . $connection_options['prefix'];
  }
  return $db_url;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
