Skip to content
Snippets Groups Projects
Commit 5c22ac47 authored by catch's avatar catch
Browse files

Issue #3426789 by mondrake, smustgrave: DatabaseDriver::load should have a...

Issue #3426789 by mondrake, smustgrave: DatabaseDriver::load should have a non-service alternative for class loading
parent 03cb2b91
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,12 @@ public function getPath() {
*/
public function load() {
if (!isset($this->classLoader)) {
$this->classLoader = \Drupal::service('class_loader');
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']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment