- foreach (array_keys($values) as $property) {
- $value = $updated_entity->get($property);
- $entity->set($property, $value);
+ /** @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));