You are here

public function Field::__sleep in Search API 8

Implements the magic __sleep() method to control object serialization.

File

src/Item/Field.php, line 699

Class

Field
Represents a field on a search item that can be indexed.

Namespace

Drupal\search_api\Item

Code

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

  // Don't serialize the index or other objects that can easily be loaded
  // again.
  unset($properties['index']);
  unset($properties['datasource']);
  unset($properties['dataDefinition']);
  unset($properties['dataTypeManager']);
  return array_keys($properties);
}