You are here

public function KeyValueEntityStorage::doLoadMultiple in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::doLoadMultiple()
  2. 10 core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::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/KeyValueStore/KeyValueEntityStorage.php, line 120

Class

KeyValueEntityStorage
Provides a key value backend for entities.

Namespace

Drupal\Core\Entity\KeyValueStore

Code

public function doLoadMultiple(array $ids = NULL) {
  if (empty($ids)) {
    $entities = $this->keyValueStore
      ->getAll();
  }
  else {
    $entities = $this->keyValueStore
      ->getMultiple($ids);
  }
  return $this
    ->mapFromStorageRecords($entities);
}