You are here

public function Index::__sleep in Search API 8

Implements the magic __sleep() method.

Prevents the instantiated plugins and fields from being serialized.

Overrides ConfigEntityBase::__sleep

File

src/Entity/Index.php, line 1977

Class

Index
Defines the search index configuration entity.

Namespace

Drupal\search_api\Entity

Code

public function __sleep() {

  // First, write our changes to the persistent *_settings properties so they
  // won't be discarded. Make sure we have a container to do this. This is
  // important to correctly display test failures.
  if (\Drupal::hasContainer()) {
    $this
      ->writeChangesToSettings();
  }

  // Then, return a list of all properties that don't contain objects.
  $properties = get_object_vars($this);
  unset($properties['datasourceInstances']);
  unset($properties['trackerInstance']);
  unset($properties['serverInstance']);
  unset($properties['processorInstances']);
  unset($properties['fieldInstances']);
  unset($properties['properties']);
  return array_keys($properties);
}