You are here

public function WebformSubmission::save in Webform 8.5

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

Saves an entity permanently.

When saving existing entities, the entity is assumed to be complete, partial updates of entities are not supported.

Return value

int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Throws

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

Overrides EntityBase::save

1 call to WebformSubmission::save()
WebformSubmission::convert in src/Entity/WebformSubmission.php
Convert anonymous submission to authenticated.

File

src/Entity/WebformSubmission.php, line 881

Class

WebformSubmission
Defines the WebformSubmission entity.

Namespace

Drupal\webform\Entity

Code

public function save() {

  // Clear the remote_addr for confidential submissions.
  if (!$this
    ->getWebform()
    ->hasRemoteAddr()) {
    $this
      ->get('remote_addr')->value = '';
  }
  return parent::save();
}