function FieldKernelTestBase::entitySaveReload
Same name and namespace in other branches
- 11.x core/modules/field/tests/src/Kernel/FieldKernelTestBase.php \Drupal\Tests\field\Kernel\FieldKernelTestBase::entitySaveReload()
- 10 core/modules/field/tests/src/Kernel/FieldKernelTestBase.php \Drupal\Tests\field\Kernel\FieldKernelTestBase::entitySaveReload()
- 8.9.x core/modules/field/tests/src/Kernel/FieldKernelTestBase.php \Drupal\Tests\field\Kernel\FieldKernelTestBase::entitySaveReload()
Saves and reloads an entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to save.
Return value
\Drupal\Core\Entity\EntityInterface The entity, freshly reloaded from storage.
File
-
core/
modules/ field/ tests/ src/ Kernel/ FieldKernelTestBase.php, line 143
Class
- FieldKernelTestBase
- Parent class for Field API unit tests.
Namespace
Drupal\Tests\field\KernelCode
protected function entitySaveReload(EntityInterface $entity) {
$entity->save();
$controller = $this->container
->get('entity_type.manager')
->getStorage($entity->getEntityTypeId());
$controller->resetCache();
return $controller->load($entity->id());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.