You are here

public function TaskManager::loadTasks in Search API 8

Load all tasks matching the given conditions.

Parameters

array $conditions: (optional) An array of conditions to be matched for the tasks, with property names mapped to the value (or values, for multiple possibilities) that the property should have.

Return value

\Drupal\search_api\Task\TaskInterface[] The loaded tasks, keyed by task ID.

Overrides TaskManagerInterface::loadTasks

File

src/Task/TaskManager.php, line 169

Class

TaskManager
Provides a service for managing pending tasks.

Namespace

Drupal\search_api\Task

Code

public function loadTasks(array $conditions = []) {
  $task_ids = $this
    ->getTasksQuery($conditions)
    ->execute();
  if ($task_ids) {
    return $this
      ->getTaskStorage()
      ->loadMultiple($task_ids);
  }
  return [];
}