You are here

protected function SqlContentEntityStorage::doLoadMultiple in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::doLoadMultiple()

Performs storage-specific loading of entities.

Override this method to add custom functionality directly after loading. This is always called, while self::postLoad() is only called when there are actual results.

Parameters

array|null $ids: (optional) An array of entity IDs, or NULL to load all entities.

Return value

\Drupal\Core\Entity\EntityInterface[] Associative array of entities, keyed on the entity ID.

Overrides EntityStorageBase::doLoadMultiple

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 409

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function doLoadMultiple(array $ids = NULL) {

  // Attempt to load entities from the persistent cache. This will remove IDs
  // that were loaded from $ids.
  $entities_from_cache = $this
    ->getFromPersistentCache($ids);

  // Load any remaining entities from the database.
  if ($entities_from_storage = $this
    ->getFromStorage($ids)) {
    $this
      ->invokeStorageLoadHook($entities_from_storage);
    $this
      ->setPersistentCache($entities_from_storage);
  }
  return $entities_from_cache + $entities_from_storage;
}