public function WebformSubmissionStorage::save in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::save()
Saves the entity permanently.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to save.
Return value
SAVED_NEW or SAVED_UPDATED is returned depending on the operation performed.
Throws
\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.
Overrides SqlContentEntityStorage::save
File
- src/
WebformSubmissionStorage.php, line 972
Class
- WebformSubmissionStorage
- Defines the webform submission storage.
Namespace
Drupal\webformCode
public function save(EntityInterface $entity) {
// Set serial number using the webform table, this is done outside of the
// main transaction initialized in parent::save() to reduce blocking
// concurrent webform submissions for as little time as possible.
if (!$entity
->serial() && !$entity
->getWebform()
->getSetting('serial_disabled')) {
$next_serial = $this
->getWebformStorage()
->getSerial($entity
->getWebform());
$entity
->set('serial', $next_serial);
}
return parent::save($entity);
}