Issue #3086850 by MasterBranch, ravi.shankar, joachim, hchonov, kiwimind, mglaman, jhedstrom: "Cannot load a NULL ID" assertion in EntityStorageBase should say the entity type

merge-requests/2419/head
Alex Pott 2020-01-16 15:30:00 +00:00
parent 8b072d6d61
commit c0f736b320
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
2 changed files with 2 additions and 2 deletions

View File

@ -246,7 +246,7 @@ abstract class EntityStorageBase extends EntityHandlerBase implements EntityStor
* {@inheritdoc}
*/
public function load($id) {
assert(!is_null($id), 'Cannot load a NULL ID.');
assert(!is_null($id), sprintf('Cannot load the "%s" entity with NULL ID.', $this->entityTypeId));
$entities = $this->loadMultiple([$id]);
return isset($entities[$id]) ? $entities[$id] : NULL;
}

View File

@ -564,7 +564,7 @@ class ConfigEntityStorageTest extends UnitTestCase {
$this->assertSame('foo', $entity->id());
$this->expectException(\AssertionError::class);
$this->expectExceptionMessage('Cannot load a NULL ID.');
$this->expectExceptionMessage(sprintf('Cannot load the "%s" entity with NULL ID.', $this->entityTypeId));
$this->entityStorage->load(NULL);
}