Maps from storage records to entity objects.
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.
array An array of entity objects implementing the EntityInterface.
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;
}