You are here

public function Database::__construct in Search API 8

Constructs a Database object.

Parameters

array $configuration: A configuration array containing settings for this backend.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Overrides BackendPluginBase::__construct

File

modules/search_api_db/src/Plugin/search_api/backend/Database.php, line 184

Class

Database
Indexes and searches items using the database.

Namespace

Drupal\search_api_db\Plugin\search_api\backend

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  if (isset($configuration['database'])) {
    list($key, $target) = explode(':', $configuration['database'], 2);

    // @todo Can we somehow get the connection in a dependency-injected way?
    $this->database = CoreDatabase::getConnection($target, $key);
  }
}