function EntityStorageBase::load

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::load()

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 294

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function load($id) {
  assert(!is_null($id), sprintf('Cannot load the "%s" entity with NULL ID.', $this->entityTypeId));
  $entities = $this->loadMultiple([
    $id,
  ]);
  return $entities[$id] ?? NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.