You are here

public function Item::__sleep in Search API 8

Implements the magic __sleep() method to avoid serializing the index.

File

src/Item/Item.php, line 484

Class

Item
Provides a default implementation for a search item.

Namespace

Drupal\search_api\Item

Code

public function __sleep() {
  $this->indexId = $this->index
    ->id();
  $properties = get_object_vars($this);

  // Don't serialize objects that can easily be loaded again. (We cannot be
  // sure about the "original object", so we do serialize that.
  unset($properties['index']);
  unset($properties['datasource']);
  unset($properties['accessResults']);
  return array_keys($properties);
}