ConfigEntityStorage::updateFromStorageRecord

public ConfigEntityStorage::updateFromStorageRecord(ConfigEntityInterface $entity, array $values)

Updates a configuration entity from storage values.

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

Parameters

ConfigEntityInterface $entity: The configuration entity to update.

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

Return value

ConfigEntityInterface The configuration entity.

Overrides ConfigEntityStorageInterface::updateFromStorageRecord

See also

\Drupal\Core\Entity\EntityStorageBase::mapFromStorageRecords()

\Drupal\field\FieldStorageConfigStorage::mapFromStorageRecords()

File

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

Class

ConfigEntityStorage
Defines the storage class for configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
public function updateFromStorageRecord(ConfigEntityInterface $entity, array $values) {
  $entity->original = clone $entity;
 
  $data = $this->mapFromStorageRecords(array($values));
  $updated_entity = current($data);
 
  foreach (array_keys($values) as $property) {
    $value = $updated_entity->get($property);
    $entity->set($property, $value);
  }
 
  return $entity;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.