function EntityStorageInterface::restore

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityStorageInterface.php \Drupal\Core\Entity\EntityStorageInterface::restore()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityStorageInterface.php \Drupal\Core\Entity\EntityStorageInterface::restore()
  3. 10 core/lib/Drupal/Core/Entity/EntityStorageInterface.php \Drupal\Core\Entity\EntityStorageInterface::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.

1 method overrides EntityStorageInterface::restore()
EntityStorageBase::restore in core/lib/Drupal/Core/Entity/EntityStorageBase.php
Restores a previously saved entity.

File

core/lib/Drupal/Core/Entity/EntityStorageInterface.php, line 145

Class

EntityStorageInterface
Defines the interface for entity storage classes.

Namespace

Drupal\Core\Entity

Code

public function restore(EntityInterface $entity);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.