W3cubDocs

/Drupal 8

public function EntityStorageBase::load

public EntityStorageBase::load($id)

Loads one entity.

Parameters

mixed $id: The ID of the entity to load.

Return value

\Drupal\Core\Entity\EntityInterface|null An entity object. NULL if no matching entity is found.

Overrides EntityStorageInterface::load

File

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

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function load($id) {
  $entities = $this->loadMultiple(array($id));
  return isset($entities[$id]) ? $entities[$id] : NULL;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityStorageBase.php/function/EntityStorageBase::load/8.1.x