function search_api_grouping_get_ids in Search API Grouping 7.2
Return a set of existing pseudo keys keyed by our custom serial id.
Parameters
string $entity_type: The entity type.
object $entity: Optional if provided we return the keys for just this entity, otherwise all entities matching the given $entity_type
Return value
array Array of pseudo_keys keyed by our custom serial id.
1 call to search_api_grouping_get_ids()
- search_api_grouping_entity_delete in ./
search_api_grouping.module - Implements hook_entity_delete().
File
- ./
search_api_grouping.module, line 191 - Module search_api_grouping.
Code
function search_api_grouping_get_ids($entity_type, $entity = NULL) {
$query = db_select('search_api_denormalized_entity', 's')
->fields('s', array(
'id',
'item_id',
))
->condition('entity_type', $entity_type);
if (!empty($entity)) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
$query
->condition('etid', $id);
}
$result = $query
->execute()
->fetchAllKeyed();
return $result;
}