You are here

public function WebformSubmissionStorage::resave in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::resave()

Resaves the entity without triggering any hooks or handlers.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to save.

Return value

bool|int If the record insert or update failed, returns FALSE. If it succeeded, returns SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.

Overrides WebformSubmissionStorageInterface::resave

File

src/WebformSubmissionStorage.php, line 1132

Class

WebformSubmissionStorage
Defines the webform submission storage.

Namespace

Drupal\webform

Code

public function resave(EntityInterface $entity) {

  /** @var \Drupal\webform\WebformSubmissionInterface $entity */
  $transaction = $this->database
    ->startTransaction();
  try {
    $return = $this
      ->doSave($entity
      ->id(), $entity);

    // Ignore replica server temporarily.
    $this->replicaKillSwitch
      ->trigger();
    return $return;
  } catch (\Exception $e) {
    $transaction
      ->rollBack();
    watchdog_exception($this->entityTypeId, $e);
    throw new EntityStorageException($e
      ->getMessage(), $e
      ->getCode(), $e);
  }
}