function ConfigEntityStorage::updateFromStorageRecord
Same name in other branches
- 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::updateFromStorageRecord()
- 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::updateFromStorageRecord()
- 11.x core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::updateFromStorageRecord()
Overrides ConfigEntityStorageInterface::updateFromStorageRecord
1 call to ConfigEntityStorage::updateFromStorageRecord()
- ConfigEntityStorage::importUpdate in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php - Updates entities upon synchronizing configuration changes.
File
-
core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php, line 447
Class
- ConfigEntityStorage
- Defines the storage class for configuration entities.
Namespace
Drupal\Core\Config\EntityCode
public function updateFromStorageRecord(ConfigEntityInterface $entity, array $values) {
$entity->original = clone $entity;
$data = $this->mapFromStorageRecords([
$values,
]);
$updated_entity = current($data);
/** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type */
$entity_type = $this->getEntityType();
$id_key = $entity_type->getKey('id');
$properties = $entity_type->getPropertiesToExport($updated_entity->get($id_key));
if (empty($properties)) {
// Fallback to using the provided values. If the properties cannot be
// determined for the config entity type annotation or configuration
// schema.
$properties = array_keys($values);
}
foreach ($properties as $property) {
if ($property === $this->uuidKey) {
// During an update the UUID field should not be copied. Under regular
// circumstances the values will be equal. If configuration is written
// twice during configuration install the updated entity will not have a
// UUID.
// @see \Drupal\Core\Config\ConfigInstaller::createConfiguration()
continue;
}
$entity->set($property, $updated_entity->get($property));
}
return $entity;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.