// Load any remaining entities from the database. This is the case if $ids
// is set to NULL (so we load all entities) or if there are any IDs left to
// load.
if ($ids === NULL ||
$ids) { $queried_entities =
$this->
doLoadMultiple($ids);
} // Pass all entities loaded from the database through $this->postLoad(),
// which attaches fields (if supported by the entity type) and calls the
// entity type specific load callback, for example hook_node_load().
if (!
empty($queried_entities)) { $this->
postLoad($queried_entities);
$entities +=
$queried_entities;
// Add queried entities to the cache.
$this->
setStaticCache($queried_entities);
} // Ensure that the returned array is ordered the same as the original
// $ids array if this was passed in and remove any invalid IDs.
if ($flipped_ids) { // Remove any invalid IDs from the array and preserve the order passed in.
$flipped_ids =
array_intersect_key($flipped_ids,
$entities);