You are here

public function DependencySerializationTrait::__wakeup in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php \Drupal\Core\DependencyInjection\DependencySerializationTrait::__wakeup()

File

lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php, line 51
Contains \Drupal\Core\DependencyInjection\DependencySerializationTrait.

Class

DependencySerializationTrait
Provides dependency injection friendly methods for serialization.

Namespace

Drupal\Core\DependencyInjection

Code

public function __wakeup() {
  $container = \Drupal::getContainer();
  foreach ($this->_serviceIds as $key => $service_id) {
    $this->{$key} = $container
      ->get($service_id);
  }
  $this->_serviceIds = array();
}