You are here

public function SearchApiEntityDataSourceController::loadItems in Search API 7

Loads items of the type of this data source controller.

Parameters

array $ids: The IDs of the items to load.

Return value

array The loaded items, keyed by ID.

Throws

SearchApiDataSourceException If any error state was encountered.

Overrides SearchApiDataSourceControllerInterface::loadItems

File

includes/datasource_entity.inc, line 83
Contains the SearchApiEntityDataSourceController class.

Class

SearchApiEntityDataSourceController
Represents a datasource for all entities known to the Entity API.

Code

public function loadItems(array $ids) {
  $items = entity_load($this->entityType, $ids);

  // If some items couldn't be loaded, remove them from tracking.
  if (count($items) != count($ids)) {
    $ids = array_flip($ids);
    $unknown = array_keys(array_diff_key($ids, $items));
    if ($unknown) {
      search_api_track_item_delete($this->type, $unknown);
    }
  }
  return $items;
}