You are here

protected function WebformSubmissionStorage::doCreate in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::doCreate()

Performs storage-specific creation of entities.

Parameters

array $values: An array of values to set, keyed by property name.

Return value

\Drupal\Core\Entity\EntityInterface

Overrides ContentEntityStorageBase::doCreate

File

src/WebformSubmissionStorage.php, line 154

Class

WebformSubmissionStorage
Defines the webform submission storage.

Namespace

Drupal\webform

Code

protected function doCreate(array $values) {

  /** @var \Drupal\webform\WebformSubmissionInterface $entity */
  $entity = parent::doCreate($values);
  if (!empty($values['data'])) {
    $data = is_array($values['data']) ? $values['data'] : Yaml::decode($values['data']);
    $entity
      ->setData($data);
  }
  return $entity;
}