function DatabaseDriver::load

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Extension/DatabaseDriver.php \Drupal\Core\Extension\DatabaseDriver::load()

Overrides Extension::load

1 call to DatabaseDriver::load()
DatabaseDriver::getInstallTasks in core/lib/Drupal/Core/Extension/DatabaseDriver.php
Returns the install tasks object instance of this database driver.

File

core/lib/Drupal/Core/Extension/DatabaseDriver.php, line 92

Class

DatabaseDriver
Defines a database driver extension object.

Namespace

Drupal\Core\Extension

Code

public function load() {
    if (!isset($this->classLoader)) {
        if (\Drupal::hasContainer() && \Drupal::hasService('class_loader')) {
            $this->classLoader = \Drupal::service('class_loader');
        }
        else {
            $this->classLoader = (require DRUPAL_ROOT . '/autoload.php');
        }
        $this->classLoader
            ->addPsr4($this->getNamespace() . '\\', $this->getPath());
        foreach ($this->getAutoloadInfo()['dependencies'] ?? [] as $dependency) {
            $this->classLoader
                ->addPsr4($dependency['namespace'] . '\\', $dependency['autoload']);
        }
    }
    return TRUE;
}

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