You are here

protected function TaskManager::getTasksQuery in Search API 8

Creates an entity query matching the given search tasks.

Parameters

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

Return value

\Drupal\Core\Entity\Query\QueryInterface An entity query for search tasks.

1 call to TaskManager::getTasksQuery()
TaskManager::executeAllTasks in src/Task/TaskManager.php
Executes all (or some) pending tasks.

File

src/Task/TaskManager.php, line 109

Class

TaskManager
Provides a service for managing pending tasks.

Namespace

Drupal\search_api\Task

Code

protected function getTasksQuery(array $conditions = []) {
  $query = $this
    ->getTaskStorage()
    ->getQuery()
    ->accessCheck(FALSE);
  foreach ($conditions as $property => $values) {
    if ($values === NULL) {
      $query
        ->notExists($property);
    }
    else {
      $query
        ->condition($property, $values, is_array($values) ? 'IN' : '=');
    }
  }
  $query
    ->sort('id');
  return $query;
}