protected function DatabaseStorageControllerNG::mapFromStorageRecords

Maps from storage records to entity objects.

Parameters

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

boolean $load_revision: (optional) TRUE if the revision should be loaded, defaults to FALSE.

Return value

array An array of entity objects implementing the EntityInterface.

2 calls to DatabaseStorageControllerNG::mapFromStorageRecords()
DatabaseStorageControllerNG::attachLoad in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
Overrides DatabaseStorageController::attachLoad().
EntityTestStorageController::mapFromStorageRecords in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php
Maps from storage records to entity objects.
1 method overrides DatabaseStorageControllerNG::mapFromStorageRecords()
EntityTestStorageController::mapFromStorageRecords in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php
Maps from storage records to entity objects.

File

drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php, line 150
Definition of Drupal\Core\Entity\DatabaseStorageControllerNG.

Class

DatabaseStorageControllerNG
Implements Field API specific enhancements to the DatabaseStorageController class.

Namespace

Drupal\Core\Entity

Code

protected function mapFromStorageRecords(array $records, $load_revision = FALSE) {
  foreach ($records as $id => $record) {
    $entity = new $this->entityClass(array(), $this->entityType);
    $entity
      ->setCompatibilityMode(TRUE);
    foreach ($record as $name => $value) {
      $entity->{$name}[LANGUAGE_DEFAULT][0]['value'] = $value;
    }
    $records[$id] = $entity;
  }
  return $records;
}