function ConfigEntityStorage::_doCreateFromStorageRecord
Same name in other branches
- 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::_doCreateFromStorageRecord()
- 8.9.x core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::_doCreateFromStorageRecord()
- 11.x core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::_doCreateFromStorageRecord()
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
\Drupal\Core\Config\Entity\ConfigEntityInterface The configuration entity.
See also
\Drupal\Core\Config\Entity\ConfigEntityStorageInterface::createFromStorageRecord()
\Drupal\Core\Config\Entity\ImportableEntityStorageInterface::importCreate()
2 calls to ConfigEntityStorage::_doCreateFromStorageRecord()
- ConfigEntityStorage::createFromStorageRecord in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php - Creates a configuration entity from storage values.
- ConfigEntityStorage::importCreate in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php - Creates entities upon synchronizing configuration changes.
File
-
core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php, line 419
Class
- ConfigEntityStorage
- Defines the storage class for configuration entities.
Namespace
Drupal\Core\Config\EntityCode
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([
$values,
]);
/** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
$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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.