You are here

public static function EckEntityBundle::loadMultiple in Entity Construction Kit (ECK) 8

Loads one or more entities.

Parameters

array $ids: An array of entity IDs, or NULL to load all entities.

Return value

static[] An array of entity objects indexed by their IDs.

Overrides EntityBase::loadMultiple

2 calls to EckEntityBundle::loadMultiple()
EckEntityBundle::load in src/Entity/EckEntityBundle.php
Loads an entity.
eck_update_8002 in ./eck.install
Re-save all bundles for all entities to set the correct dependencies.

File

src/Entity/EckEntityBundle.php, line 124

Class

EckEntityBundle
Defines the ECK entity bundle configuration entity.

Namespace

Drupal\eck\Entity

Code

public static function loadMultiple(array $ids = NULL) {

  // Because we use a single class for multiple entity bundles we need to
  // parse all entity types and load the bundles.
  $entity_manager = \Drupal::entityTypeManager();
  $bundles = [];

  /** @var EckEntityType $entity */
  foreach (EckEntityType::loadMultiple() as $entity) {
    $bundleStorage = $entity_manager
      ->getStorage($entity
      ->id() . '_type');
    $bundles = array_merge($bundles, $bundleStorage
      ->loadMultiple($ids));
  }
  return $bundles;
}