Converts the passed entities to partially created ones.
This replicates the partial entities created in field_purge_data_batch(), which only have the ids and the to be deleted field defined.
$entities: An array of entities of type test_entity.
$field_name: A field name whose data should be copied from $entities into the returned partial entities.
An array of partial entities corresponding to $entities.
protected function convertToPartialEntities($entities, $field_name) {
$partial_entities = array();
foreach ($entities as $id => $entity) {
// Re-create the entity to match what is expected
// _field_create_entity_from_ids().
$ids = (object) array(
'entity_id' => $entity->ftid,
'revision_id' => $entity->ftvid,
'bundle' => $entity->fttype,
'entity_type' => 'test_entity',
);
$partial_entities[$id] = _field_create_entity_from_ids($ids);
$partial_entities[$id]->{$field_name} = $entity->{$field_name};
}
return $partial_entities;
}