8.3.x DependencySerializationTrait.php public DependencySerializationTrait::__wakeup()
8.0.x DependencySerializationTrait.php public DependencySerializationTrait::__wakeup()
8.1.x DependencySerializationTrait.php public DependencySerializationTrait::__wakeup()
8.2.x DependencySerializationTrait.php public DependencySerializationTrait::__wakeup()
8.4.x DependencySerializationTrait.php public DependencySerializationTrait::__wakeup()
2 calls to DependencySerializationTrait::__wakeup()
ForumManager::__wakeup in core/modules/forum/src/ForumManager.php
TermStorage::__wakeup in core/modules/taxonomy/src/TermStorage.php
2 methods override DependencySerializationTrait::__wakeup()
EntityDisplayBase::__wakeup in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
TermStorage::__wakeup in core/modules/taxonomy/src/TermStorage.php

File

core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php, line 46

Class

DependencySerializationTrait
Provides dependency injection friendly methods for serialization.

Namespace

Drupal\Core\DependencyInjection

Code

public function __wakeup() {
  // Tests in isolation potentially unserialize in the parent process.
  if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP']) && !\Drupal::hasContainer()) {
    return;
  }
  $container = \Drupal::getContainer();
  foreach ($this->_serviceIds as $key => $service_id) {
    $this->$key = $container->get($service_id);
  }
  $this->_serviceIds = array();
}