function entity_test_load in Drupal 8
Loads a test entity.
Parameters
int $id: A test entity ID.
bool $reset: A boolean indicating that the internal cache should be reset.
Return value
\Drupal\entity_test\Entity\EntityTest The loaded entity object, or NULL if the entity cannot be loaded.
Deprecated
in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal::entityTypeManager()->getStorage('entity_test')->load().
See also
https://www.drupal.org/node/2266845
File
- core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module, line 374 - Test module for the entity API providing several entity types for testing.
Code
function entity_test_load($id, $reset = FALSE) {
@trigger_error('entity_test_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal::entityTypeManager()->getStorage(\'entity_test\')->load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
$storage = \Drupal::entityTypeManager()
->getStorage('entity_test');
if ($reset) {
$storage
->resetCache([
$id,
]);
}
return $storage
->load($id);
}