You are here

public function WebformEntityStorage::save in Webform 8.5

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

Implements Drupal\Core\Entity\EntityStorageInterface::save().

Throws

\Drupal\Core\Entity\EntityMalformedException When attempting to save a configuration entity that has no ID.

Overrides ConfigEntityStorage::save

File

src/WebformEntityStorage.php, line 132

Class

WebformEntityStorage
Storage controller class for "webform" configuration entities.

Namespace

Drupal\webform

Code

public function save(EntityInterface $entity) {
  $return = parent::save($entity);
  if ($return === SAVED_NEW) {

    // Insert webform database record used for transaction tracking.
    $this->database
      ->insert('webform')
      ->fields([
      'webform_id' => $entity
        ->id(),
      'next_serial' => 1,
    ])
      ->execute();
  }
  return $return;
}