function Extension::__wakeup

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/Extension.php \Drupal\Core\Extension\Extension::__wakeup()
  2. 8.9.x core/lib/Drupal/Core/Extension/Extension.php \Drupal\Core\Extension\Extension::__wakeup()
  3. 10 core/lib/Drupal/Core/Extension/Extension.php \Drupal\Core\Extension\Extension::__wakeup()

Magic method implementation to unserialize the extension object.

File

core/lib/Drupal/Core/Extension/Extension.php, line 193

Class

Extension
Defines an extension (file) object.

Namespace

Drupal\Core\Extension

Code

public function __wakeup() : void {
    // Get the app root from the container. While compiling the container we
    // have to discover all the extension service files in
    // \Drupal\Core\DrupalKernel::initializeServiceProviders(). This results in
    // creating extension objects before the container has the kernel.
    // Specifically, this occurs during the call to
    // \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory().
    $container = \Drupal::hasContainer() ? \Drupal::getContainer() : FALSE;
    $this->root = $container && $container->hasParameter('app.root') ? $container->getParameter('app.root') : DRUPAL_ROOT;
}

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