entity_create_stub_entity($entity_type, $ids)Helper function to assemble an object structure with initial ids.
This function can be seen as reciprocal to entity_extract_ids().
$entity_type The entity type; e.g. 'node' or 'user'.
$ids A numerically indexed array, as returned by entity_extract_ids(), containing these elements: 0: primary id of the entity 1: revision id of the entity, or NULL if $entity_type is not versioned 2: bundle name of the entity
An entity structure, initialized with the ids provided.
includes/common.inc, line 6338
<?php
function entity_create_stub_entity($entity_type, $ids) {
$entity = new stdClass();
$info = entity_get_info($entity_type);
$entity->{$info['object keys']['id']} = $ids[0];
if (isset($info['object keys']['revision']) && !is_null($ids[1])) {
$entity->{$info['object keys']['revision']} = $ids[1];
}
if ($info['object keys']['bundle']) {
$entity->{$info['object keys']['bundle']} = $ids[2];
}
return $entity;
}
?>