function FieldStorageConfigStorage::mapFromStorageRecords

Same name and namespace in other branches
  1. 8.9.x core/modules/field/src/FieldStorageConfigStorage.php \Drupal\field\FieldStorageConfigStorage::mapFromStorageRecords()
  2. 10 core/modules/field/src/FieldStorageConfigStorage.php \Drupal\field\FieldStorageConfigStorage::mapFromStorageRecords()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.