Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityBase.php

function EntityBase::load

Overrides EntityInterface::load

File

core/lib/Drupal/Core/Entity/EntityBase.php, line 499

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public static function load($id) {
    $entity_type_repository = \Drupal::service('entity_type.repository');
    $entity_type_manager = \Drupal::entityTypeManager();
    $storage = $entity_type_manager->getStorage($entity_type_repository->getEntityTypeFromClass(static::class));
    return $storage->load($id);
}
RSS feed
Powered by Drupal