ConfigEntityStorage::_doCreateFromStorageRecord

protected ConfigEntityStorage::_doCreateFromStorageRecord(array $values, $is_syncing = FALSE)

Helps create a configuration entity from storage values.

Allows the configuration entity storage to massage storage values before creating an entity.

Parameters

array $values: The array of values from the configuration storage.

bool $is_syncing: Is the configuration entity being created as part of a config sync.

Return value

ConfigEntityInterface The configuration entity.

See also

\Drupal\Core\Config\Entity\ConfigEntityStorageInterface::createFromStorageRecord()

\Drupal\Core\Config\Entity\ImportableEntityStorageInterface::importCreate()

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php, line 447

Class

ConfigEntityStorage
Defines the storage class for configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

protected function _doCreateFromStorageRecord(array $values, $is_syncing = FALSE) {
  // Assign a new UUID if there is none yet.
  if ($this->uuidKey && $this->uuidService && !isset($values[$this->uuidKey])) {
    $values[$this->uuidKey] = $this->uuidService->generate();
  }
  $data = $this->mapFromStorageRecords(array($values));
  $entity = current($data);
  $entity->original = clone $entity;
  $entity->setSyncing($is_syncing);
  $entity->enforceIsNew();
  $entity->postCreate($this);

  // Modules might need to add or change the data initially held by the new
  // entity object, for instance to fill-in default values.
  $this->invokeHook('create', $entity);
  return $entity;

}
doc_Drupal
2016-10-29 08:52:57
Comments
Leave a Comment

Please login to continue.