In file_get_file_references()
, the references are loaded and iterated over:
<?php
$usage_list = file_usage()->listUsage($file);
$file_usage_list = isset($usage_list['file']) ? $usage_list['file'] : array();
foreach ($file_usage_list as $entity_type => $entity_ids) {
$entity_info = entity_get_info($entity_type);
// The usage table contains usage of every revision. If we are looking
// for every revision or the entity does not support revisions then
// every usage is already a match.
$match_entity_type = $age == FIELD_LOAD_REVISION || !isset($entity_info['entity_keys']['revision']);
$entities = entity_load_multiple($entity_type, $entity_ids);
?>
However the value returned by FileUsageInterface::listUsage()
has the array for each entity type keyed by entity id with the usage count as the value. As a result, the file usage counts are passed to entity_load_multiple()
and not the entity ids.