Add loadAll() to EntityStorageInterface

Created on 16 December 2013, almost 11 years ago
Updated 31 January 2023, almost 2 years ago

We accomplish this currently by passing a NULL argument to loadMultiple:

/**
   * Loads one or more entities.
   *
   * @param $ids
   *   An array of entity IDs, or NULL to load all entities.
   *
   * @return
   *   An array of entity objects indexed by their ids.
   */
  public function loadMultiple(array $ids = NULL);

Not only is it generally a bad coding practice to accept multiple types in a method signature, but this behavior isn't exactly intuitive. I noticed this while working on #597236: Add entity caching to core β†’ , which has excessive conditional logic to account for the multiple argument types. It also should be noted in Drupal 7 one needed to pass FALSE to entity_load instead of NULL which just adds to the confusion.

It would be a lot simpler to just add loadAll and let loadMultiple require an array.

πŸ“Œ Task
Status

Needs work

Version

9.5

Component
EntityΒ  β†’

Last updated 14 minutes ago

Created by

πŸ‡ΊπŸ‡ΈUnited States msonnabaum

Live updates comments and jobs are added and updated live.
  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Reading the comments seems there's still discussion on the approach that should be taken.

    Tagged for IS update so when that solution is decided on it can be added there.

    Thanks!

Production build 0.71.5 2024