You are here

protected function YamlFormSubmissionStorage::doCreate in YAML Form 8

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/YamlFormSubmissionStorage.php, line 73

Class

YamlFormSubmissionStorage
Defines the form submission storage.

Namespace

Drupal\yamlform

Code

protected function doCreate(array $values) {

  /** @var \Drupal\yamlform\YamlFormSubmissionInterface $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;
}