protected function DatabaseStorageControllerNG::attachLoad

Overrides DatabaseStorageController::attachLoad().

Added mapping from storage records to entities.

Overrides DatabaseStorageController::attachLoad

5 calls to DatabaseStorageControllerNG::attachLoad()
6 methods override DatabaseStorageControllerNG::attachLoad()

File

drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php, line 211
Contains \Drupal\Core\Entity\DatabaseStorageControllerNG.

Class

DatabaseStorageControllerNG
Implements Field API specific enhancements to the DatabaseStorageController class.

Namespace

Drupal\Core\Entity

Code

protected function attachLoad(&$queried_entities, $load_revision = FALSE) {

  // Map the loaded stdclass records into entity objects and according fields.
  $queried_entities = $this
    ->mapFromStorageRecords($queried_entities, $load_revision);
  if ($this->entityInfo['fieldable']) {
    if ($load_revision) {
      field_attach_load_revision($this->entityType, $queried_entities);
    }
    else {
      field_attach_load($this->entityType, $queried_entities);
    }
  }

  // Call hook_entity_load().
  foreach (module_implements('entity_load') as $module) {
    $function = $module . '_entity_load';
    $function($queried_entities, $this->entityType);
  }

  // Call hook_TYPE_load(). The first argument for hook_TYPE_load() are
  // always the queried entities, followed by additional arguments set in
  // $this->hookLoadArguments.
  $args = array_merge(array(
    $queried_entities,
  ), $this->hookLoadArguments);
  foreach (module_implements($this->entityType . '_load') as $module) {
    call_user_func_array($module . '_' . $this->entityType . '_load', $args);
  }
}