function EntityBase::load
Loads an entity.
Parameters
mixed $id: The id of the entity to load.
Return value
static|null The entity object or NULL if there is no entity with the given ID.
Overrides EntityInterface::load
File
- 
              core/lib/ Drupal/ Core/ Entity/ EntityBase.php, line 499 
Class
- EntityBase
- Defines a base entity class.
Namespace
Drupal\Core\EntityCode
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);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
