| 1 field.module | _field_create_entity_from_ids($ids) | 
        
Assembles a partial entity structure with initial IDs.
This can be used to create an entity based on the the ids object returned by EntityFieldQuery.
Parameters
stdClass $ids: An object with the properties entity_type (required), entity_id (required), revision_id (optional) and bundle (optional).
Return value
An entity, initialized with the provided IDs.:
File
- core/
modules/ field/ field.module, line 1490  - Attach custom data fields to Backdrop entities.
 
Code
function _field_create_entity_from_ids($ids) {
  $id_properties = array();
  $info = entity_get_info($ids->entity_type);
  $id_properties[$info['entity keys']['id']] = $ids->entity_id;
  if (!empty($info['entity keys']['revision']) && isset($ids->revision_id)) {
    $id_properties[$info['entity keys']['revision']] = $ids->revision_id;
  }
  if (!empty($info['entity keys']['bundle']) && isset($ids->bundle)) {
    $id_properties[$info['entity keys']['bundle']] = $ids->bundle;
  }
  return entity_create($ids->entity_type, $id_properties);
}