public function Item::__wakeup in Search API 8
Implements the magic __wakeup() method to control object unserialization.
File
- src/
Item/ Item.php, line 498
Class
- Item
- Provides a default implementation for a search item.
Namespace
Drupal\search_api\ItemCode
public function __wakeup() {
// Make sure we have a container to do this. Otherwise, there could be
// errors when displaying failed tests.
if ($this->indexId && \Drupal::hasContainer()) {
$this->index = \Drupal::entityTypeManager()
->getStorage('search_api_index')
->load($this->indexId);
$this->indexId = NULL;
if ($this->index && $this->fields) {
foreach ($this->fields as $field) {
$field
->setIndex($this->index);
}
}
}
}