You are here

protected function BackendPluginBase::validateOperator in Search API 8

Verifies that the given condition operator is valid for this backend.

Parameters

string $operator: The operator in question.

Throws

\Drupal\search_api\SearchApiException Thrown if the operator is not known.

See also

\Drupal\search_api\Query\ConditionSetInterface::addCondition()

1 call to BackendPluginBase::validateOperator()
Database::createDbCondition in modules/search_api_db/src/Plugin/search_api/backend/Database.php
Creates a database query condition for a given search filter.

File

src/Backend/BackendPluginBase.php, line 315

Class

BackendPluginBase
Defines a base class for backend plugins.

Namespace

Drupal\search_api\Backend

Code

protected function validateOperator($operator) {
  switch ($operator) {
    case '=':
    case '<>':
    case '<':
    case '<=':
    case '>=':
    case '>':
    case 'IN':
    case 'NOT IN':
    case 'BETWEEN':
    case 'NOT BETWEEN':
      return;
  }
  throw new SearchApiException("Unknown operator '{$operator}' used in search query condition");
}