You are here

function file_load_multiple in Drupal 8

Same name and namespace in other branches
  1. 7 includes/file.inc \file_load_multiple()

Loads file entities from the database.

Parameters

array|null $fids: (optional) An array of entity IDs. If omitted or NULL, all entities are loaded.

bool $reset: (optional) Whether to reset the internal file_load_multiple() cache. Defaults to FALSE.

Return value

array An array of file entities, indexed by fid.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\file\Entity\File::loadMultiple().

See also

https://www.drupal.org/node/2266845

1 call to file_load_multiple()
FileLegacyTest::testEntityLegacyCode in core/modules/file/tests/src/Kernel/FileLegacyTest.php
@expectedDeprecation file_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\file\Entity\File::loadMultiple(). See https://www.drupal.org/node/2266845 @expectedDeprecation file_load() is deprecated in…

File

core/modules/file/file.module, line 89
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_load_multiple(array $fids = NULL, $reset = FALSE) {
  @trigger_error('file_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\file\\Entity\\File::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
  if ($reset) {
    \Drupal::entityTypeManager()
      ->getStorage('file')
      ->resetCache($fids);
  }
  return File::loadMultiple($fids);
}