function EntityStorageBase::mapFromStorageRecords

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::mapFromStorageRecords()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::mapFromStorageRecords()
  3. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::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.

8 calls to EntityStorageBase::mapFromStorageRecords()
ConfigEntityStorage::doLoadMultiple in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Performs storage-specific loading of entities.
ConfigEntityStorage::doSave in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Performs storage-specific saving of the entity.
ConfigEntityStorage::updateFromStorageRecord in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Updates a configuration entity from storage values.
ConfigEntityStorage::_doCreateFromStorageRecord in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Helps create a configuration entity from storage values.
FieldConfigStorageBase::mapFromStorageRecords in core/lib/Drupal/Core/Field/FieldConfigStorageBase.php
Maps from storage records to entity objects.

... See full list

4 methods override EntityStorageBase::mapFromStorageRecords()
FieldConfigStorageBase::mapFromStorageRecords in core/lib/Drupal/Core/Field/FieldConfigStorageBase.php
Maps from storage records to entity objects.
FieldStorageConfigStorage::mapFromStorageRecords in core/modules/field/src/FieldStorageConfigStorage.php
Maps from storage records to entity objects.
LayoutBuilderEntityViewDisplayStorage::mapFromStorageRecords in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php
Maps from storage records to entity objects.
SqlContentEntityStorage::mapFromStorageRecords in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Maps from storage records to entity objects, and attaches fields.

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 413

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

protected function mapFromStorageRecords(array $records) {
    $entities = [];
    foreach ($records as $record) {
        $entity_class = $this->getEntityClass();
        
        /** @var \Drupal\Core\Entity\EntityInterface $entity */
        $entity = new $entity_class($record, $this->entityTypeId);
        $entities[$entity->id()] = $entity;
    }
    return $entities;
}

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