protected function CourseObjectStorage::mapFromStorageRecords in Course 8.3
Same name and namespace in other branches
- 8.2 src/Storage/CourseObjectStorage.php \Drupal\course\Storage\CourseObjectStorage::mapFromStorageRecords()
- 3.x src/Storage/CourseObjectStorage.php \Drupal\course\Storage\CourseObjectStorage::mapFromStorageRecords()
When loading from the database, map any object to its respective class.
Overrides SqlContentEntityStorage::mapFromStorageRecords
File
- src/
Storage/ CourseObjectStorage.php, line 33
Class
Namespace
Drupal\course\StorageCode
protected function mapFromStorageRecords(array $records, $load_from_revision = FALSE) {
$available = course_get_handlers();
$out = [];
foreach ($records as $id => $record) {
$ret = $available[$record->object_type];
if ($ret['class']) {
$this->entityClass = $ret['class'];
}
else {
$this->entityClass = 'Drupal\\course\\Course\\Object\\CourseObjectBroken';
}
$entities = parent::mapFromStorageRecords([
$id => $record,
], $load_from_revision);
$out += $entities;
}
return $out;
}