You are here

public function Task::getData in Search API 8

Retrieves the additional data associated with this task, if any.

Return value

mixed|null The additional data.

Overrides TaskInterface::getData

File

src/Entity/Task.php, line 140

Class

Task
Defines the Search API task entity class.

Namespace

Drupal\search_api\Entity

Code

public function getData() {
  if (!isset($this->unserializedData)) {
    $data = $this
      ->get('data')[0];
    if ($data) {
      $this->unserializedData = unserialize($data->value);
      if (!empty($this->unserializedData['#entity_type'])) {
        $this->unserializedData = \Drupal::entityTypeManager()
          ->getStorage($this->unserializedData['#entity_type'])
          ->create($this->unserializedData['#values']);
      }
    }
  }
  return $this->unserializedData;
}