DependencySerializationTrait::__wakeup

public DependencySerializationTrait::__wakeup()

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();
}
doc_Drupal
2016-10-29 09:02:14
Comments
Leave a Comment

Please login to continue.