function EntityStorageBase::load

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::load()
  2. 10 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::load()
  3. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::load()

Overrides EntityStorageInterface::load

10 calls to EntityStorageBase::load()
ConfigEntityStorage::importDelete in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
ConfigEntityStorage::importUpdate in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
ContentEntityStorageBase::createRevision in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
ContentEntityStorageBase::loadUnchanged in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
EntityStorageBase::loadUnchanged in core/lib/Drupal/Core/Entity/EntityStorageBase.php

... See full list

2 methods override EntityStorageBase::load()
ContentEntityNullStorage::load in core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
EntityTestNoLoadStorage::load in core/modules/system/tests/modules/entity_test/src/EntityTestNoLoadStorage.php
Loads one entity.

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.