public function EntitySubqueueStorage::restore in Entityqueue 8
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 SqlContentEntityStorage::restore
File
- src/
EntitySubqueueStorage.php, line 16
Class
- EntitySubqueueStorage
- Defines the storage handler class for entity subqueues.
Namespace
Drupal\entityqueueCode
public function restore(EntityInterface $entity) {
// Since subqueues have string IDs, the revision ID can not be set
// automatically during a schema conversion.
$revision_id = $this->database
->select($this
->getTableMapping()
->getRevisionTable())
->countQuery()
->execute()
->fetchField() + 1;
$entity
->set($this->revisionKey, $revision_id);
parent::restore($entity);
}