You are here

public function Query::__wakeup in Search API 8

Implements the magic __wakeup() method to reload the query's index.

File

src/Query/Query.php, line 815

Class

Query
Provides a standard implementation for a Search API query.

Namespace

Drupal\search_api\Query

Code

public function __wakeup() {
  if (!isset($this->index) && !empty($this->indexId) && \Drupal::hasContainer() && \Drupal::getContainer()
    ->has('entity_type.manager')) {
    $this->index = \Drupal::entityTypeManager()
      ->getStorage('search_api_index')
      ->load($this->indexId);
    $this->indexId = NULL;
  }
  $this
    ->traitWakeup();
}