You are here

protected function FieldStorageConfigStorage::mapFromStorageRecords in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/src/FieldStorageConfigStorage.php \Drupal\field\FieldStorageConfigStorage::mapFromStorageRecords()

Maps from storage records to entity objects.

Parameters

array $records: Associative array of query results, keyed on the entity ID.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entity objects implementing the EntityInterface.

Overrides EntityStorageBase::mapFromStorageRecords

File

core/modules/field/src/FieldStorageConfigStorage.php, line 160

Class

FieldStorageConfigStorage
Storage handler for "field storage" configuration entities.

Namespace

Drupal\field

Code

protected function mapFromStorageRecords(array $records) {
  foreach ($records as $id => &$record) {
    try {
      $class = $this->fieldTypeManager
        ->getPluginClass($record['type']);
    } catch (PluginNotFoundException $e) {
      $config_id = $this
        ->getPrefix() . $id;
      throw new PluginNotFoundException($record['type'], "Unable to determine class for field type '{$record['type']}' found in the '{$config_id}' configuration", $e
        ->getCode(), $e);
    }
    $record['settings'] = $class::storageSettingsFromConfigData($record['settings']);
  }
  return parent::mapFromStorageRecords($records);
}