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
Delete entities upon synchronizing configuration changes.
ConfigEntityStorage::importUpdate in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Updates entities upon synchronizing configuration changes.
ContentEntityStorageBase::createRevision in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Creates a new revision starting off from the specified entity object.
ContentEntityStorageBase::loadUnchanged in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Loads an unchanged entity from the database.
EntityStorageBase::loadUnchanged in core/lib/Drupal/Core/Entity/EntityStorageBase.php
Loads an unchanged entity from the database.

... See full list

2 methods override EntityStorageBase::load()
ContentEntityNullStorage::load in core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
Loads one entity.
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.