W3cubDocs

/Drupal 8

protected function EntityStorageBase::mapFromStorageRecords

protected EntityStorageBase::mapFromStorageRecords(array $records)

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.

File

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

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

protected function mapFromStorageRecords(array $records) {
  $entities = array();
  foreach ($records as $record) {
    $entity = new $this->entityClass($record, $this->entityTypeId);
    $entities[$entity->id()] = $entity;
  }
  return $entities;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityStorageBase.php/function/EntityStorageBase::mapFromStorageRecords/8.1.x