function entity_uuid_load in Universally Unique IDentifier 7
Load entities by their UUID, that only should containing UUID references.
Optionally load revisions by their VUUID by passing it into $conditions. Ex. $conditions['vuuid'][$vuuid]
This function is mostly useful if you want to load an entity from the local database that only should contain UUID references.
See also
Related topics
8 calls to entity_uuid_load()
- UUIDCommentTestCase::testCommentCrud in ./uuid.test 
- Test CRUD on comments with UUID functions.
- UUIDNodeTestCase::testNodeCrud in ./uuid.test 
- Tests CRUD on nodes with UUID functions.
- UUIDTaxonomyTestCase::testTaxonomyCrud in ./uuid.test 
- Test CRUD on comments with UUID functions.
- UUIDUserTestCase::testUserCrud in ./uuid.test 
- Test CRUD on users with UUID functions.
- uuid_devel_load_by_uuid in ./uuid.admin.inc 
- Page callback to display Devel information about a UUID entity.
2 string references to 'entity_uuid_load'
- entity_make_entity_universal in ./uuid.entity.inc 
- Helper function to make an entity universal (i.e. only global references).
- uuid_hook_info in ./uuid.module 
- Implements hook_hook_info().
File
- ./uuid.entity.inc, line 176 
- Entity related functions for UUID module.
Code
function entity_uuid_load($entity_type, $uuids = array(), $conditions = array(), $reset = FALSE) {
  // Allow Revision UUID to be passed in $conditions and translate.
  $entity_info[$entity_type] = entity_get_info($entity_type);
  $revision_key = $entity_info[$entity_type]['entity keys']['revision'];
  if (isset($entity_info[$entity_type]['entity keys']['revision uuid'])) {
    $revision_uuid_key = $entity_info[$entity_type]['entity keys']['revision uuid'];
  }
  if (isset($revision_uuid_key) && isset($conditions[$revision_uuid_key])) {
    $revision_id = entity_get_id_by_uuid($entity_type, array(
      $conditions[$revision_uuid_key],
    ), TRUE);
    $conditions[$revision_key] = $revision_id[$conditions[$revision_uuid_key]];
    unset($conditions[$revision_uuid_key]);
  }
  $ids = entity_get_id_by_uuid($entity_type, $uuids);
  $results = entity_load($entity_type, $ids, $conditions, $reset);
  $entities = array();
  // We need to do this little magic here, because objects are passed by
  // reference. And because hook_entity_uuid_load() has the intention changing
  // primary properties and fields from local IDs to UUIDs it will also change
  // DrupalDefaultEntityController::entityCache by reference which is a static
  // cache of entities. And that is not something we want.
  foreach ($results as $key => $entity) {
    // This will avoid passing our loaded entities by reference.
    $entities[$key] = clone $entity;
  }
  entity_make_entity_universal($entity_type, $entities);
  return $entities;
}