protected function EntityFormTest::loadEntityByName in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Entity/EntityFormTest.php \Drupal\system\Tests\Entity\EntityFormTest::loadEntityByName()
Loads a test entity by name always resetting the storage cache.
2 calls to EntityFormTest::loadEntityByName()
- EntityFormTest::doTestFormCRUD in core/
modules/ system/ src/ Tests/ Entity/ EntityFormTest.php - Executes the form CRUD tests for the given entity type.
- EntityFormTest::doTestMultilingualFormCRUD in core/
modules/ system/ src/ Tests/ Entity/ EntityFormTest.php - Executes the multilingual form CRUD tests for the given entity type ID.
File
- core/
modules/ system/ src/ Tests/ Entity/ EntityFormTest.php, line 144 - Contains \Drupal\system\Tests\Entity\EntityFormTest.
Class
- EntityFormTest
- Tests the entity form.
Namespace
Drupal\system\Tests\EntityCode
protected function loadEntityByName($entity_type, $name) {
// Always load the entity from the database to ensure that changes are
// correctly picked up.
$entity_storage = $this->container
->get('entity.manager')
->getStorage($entity_type);
$entity_storage
->resetCache();
$entities = $entity_storage
->loadByProperties(array(
'name' => $name,
));
return $entities ? current($entities) : NULL;
}