public function EntityStorageBase::restore in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::restore()
- 10 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::restore()
Restores a previously saved entity.
Note that the entity is assumed to be in a valid state for the storage, so the restore process does not invoke any hooks, nor does it perform any pre or post-save operations.
@internal This method should never be used to perform a regular entity save. Its only use-case is to assist updating entity types when there are complex schema changes, for example, to make them revisionable. Note that overriding this method to fix data prior to restoring is a likely sign that the current data is corrupt.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to restore.
Throws
\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.
Overrides EntityStorageInterface::restore
1 method overrides EntityStorageBase::restore()
- SqlContentEntityStorage::restore in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorage.php - Restores a previously saved entity.
File
- core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php, line 548
Class
- EntityStorageBase
- A base entity storage class.
Namespace
Drupal\Core\EntityCode
public function restore(EntityInterface $entity) {
// The restore process does not invoke any pre or post-save operations.
$this
->doSave($entity
->id(), $entity);
}