function DependencySerializationTrait::__wakeup
Attributes
#[\ReturnTypeWillChange]
  4 calls to DependencySerializationTrait::__wakeup()
- ConfigImporter::reInjectMe in core/
lib/ Drupal/ Core/ Config/ ConfigImporter.php  - Gets all the service dependencies from \Drupal.
 - ForumManager::__wakeup in core/
modules/ forum/ src/ ForumManager.php  - StorageComparer::__wakeup in core/
lib/ Drupal/ Core/ Config/ StorageComparer.php  - TermStorage::__wakeup in core/
modules/ taxonomy/ src/ TermStorage.php  - #[\ReturnTypeWillChange]
 
2 methods override DependencySerializationTrait::__wakeup()
- EntityDisplayBase::__wakeup in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php  - #[\ReturnTypeWillChange]
 - TermStorage::__wakeup in core/
modules/ taxonomy/ src/ TermStorage.php  - #[\ReturnTypeWillChange]
 
File
- 
              core/
lib/ Drupal/ Core/ DependencyInjection/ DependencySerializationTrait.php, line 73  
Class
- DependencySerializationTrait
 - Provides dependency injection friendly methods for serialization.
 
Namespace
Drupal\Core\DependencyInjectionCode
public function __wakeup() {
  // Avoid trying to wakeup if there's nothing to do.
  if (empty($this->_serviceIds) && empty($this->_entityStorages)) {
    return;
  }
  $container = \Drupal::getContainer();
  foreach ($this->_serviceIds as $key => $service_id) {
    $this->{$key} = $container->get($service_id);
  }
  $this->_serviceIds = [];
  if ($this->_entityStorages) {
    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $container->get('entity_type.manager');
    foreach ($this->_entityStorages as $key => $entity_type_id) {
      $this->{$key} = $entity_type_manager->getStorage($entity_type_id);
    }
  }
  $this->_entityStorages = [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.