You are here

static function SearchApiEtHelper::getGroupedItemsIdsByEntity in Search API Entity Translation 7.2

Helper function to group the given list of ItemIds by EntityIds

Parameters

array $item_ids: The list of trackable ItemID (in the form "{entity_id}/{language}")

Return value

array A multilevel array where the outer array is keyed by the EntityID, and contains all the corresponding ItemIDs.

2 calls to SearchApiEtHelper::getGroupedItemsIdsByEntity()
SearchApiEtDatasourceController::filterTrackableIds in includes/SearchApiEtDatasourceController.php
Filters the given Item IDs to include only the ones handled by the Index.
SearchApiEtHelperTest::testGetGroupedItemsIdsByEntity in tests/SearchApiEtHelperTest.php
@dataProvider dataProviderGetGroupedItemsIdsByEntity

File

includes/SearchApiEtHelper.php, line 100
Helper class for SearchAPI ET

Class

SearchApiEtHelper
@file Helper class for SearchAPI ET

Code

static function getGroupedItemsIdsByEntity($item_ids) {
  $ret = array();
  foreach ($item_ids as $item_id) {
    $entity_id = self::splitItemId($item_id, self::ITEM_ID_ENTITY_ID);
    if ($entity_id) {
      $ret[$entity_id][] = $item_id;
    }
  }
  return $ret;
}