function DatabaseDriver::getAutoloadInfo

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

File

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

Class

DatabaseDriver
Defines a database driver extension object.

Namespace

Drupal\Core\Extension

Code

public function getAutoloadInfo() : array {
  $this->getModuleInfo();
  $autoloadInfo = [
    'namespace' => $this->getNamespace(),
    'autoload' => $this->getPath() . DIRECTORY_SEPARATOR,
  ];
  foreach ($this->info['dependencies'] ?? [] as $dependency) {
    $dependencyData = Dependency::createFromString($dependency);
    $dependencyName = $dependencyData->getName();
    if (empty($this->discoveredModules[$dependencyName])) {
      throw new \RuntimeException(sprintf("Cannot find the module '%s' that is required by module '%s'", $dependencyName, $this->getModule()
        ->getName()));
    }
    $autoloadInfo['dependencies'][$dependencyName] = [
      'namespace' => "Drupal\\{$dependencyName}",
      'autoload' => $this->discoveredModules[$dependencyName]
        ->getPath() . '/src/',
    ];
  }
  return $autoloadInfo;
}

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