You are here

protected function SearchApiAbstractDataSourceController::checkIndex in Search API 7

Checks whether the given index is valid for this datasource controller.

Helper method used by various methods in this class. By default only checks whether the types match.

Parameters

SearchApiIndex $index: The index to check.

Throws

SearchApiDataSourceException If the index doesn't fit to this datasource controller.

9 calls to SearchApiAbstractDataSourceController::checkIndex()
SearchApiAbstractDataSourceController::getChangedItems in includes/datasource.inc
Retrieves a list of items that need to be indexed.
SearchApiAbstractDataSourceController::getIndexStatus in includes/datasource.inc
Retrieves information on how many items have been indexed for a certain index.
SearchApiAbstractDataSourceController::stopTracking in includes/datasource.inc
Stops tracking of the index status of items for the given indexes.
SearchApiAbstractDataSourceController::trackItemChange in includes/datasource.inc
Sets the tracking status of the given items to "changed"/"dirty".
SearchApiAbstractDataSourceController::trackItemDelete in includes/datasource.inc
Stops tracking the index status for the given items on the given indexes.

... See full list

File

includes/datasource.inc, line 868
Contains the SearchApiDataSourceControllerInterface as well as a default base class.

Class

SearchApiAbstractDataSourceController
Provides a default base class for datasource controllers.

Code

protected function checkIndex(SearchApiIndex $index) {
  if ($index->item_type != $this->type) {
    $index_type = search_api_get_item_type_info($index->item_type);
    $index_type = empty($index_type['name']) ? $index->item_type : $index_type['name'];
    $msg = t('Invalid index @index of type @index_type passed to data source controller for type @this_type.', array(
      '@index' => $index->name,
      '@index_type' => $index_type,
      '@this_type' => $this->info['name'],
    ));
    throw new SearchApiDataSourceException($msg);
  }
}