hook_feeds_processor_target_alter()を実装して、指定したエンティティタイプに任意のプロパティ/フィールドをユニックキーの指定ができます
/**
* Implements hook_feeds_processor_targets_alter().
*/
function MODULE_feeds_processor_targets_alter(array &$targets, $entity_type, $bundle)
{
if( $entity_type == "drills_ch_vocabulary" ){
$targets['vocabulary'] = array(
'name' => t('vocabulary'),
'description' => t('Vocabulary that can be unique target'),
'callback' => 'vocabulary_mapper_set_target',
'optional_unique' => TRUE,
'unique_callbacks' => array('vocabulary_mapper_unique'),
);
}
}
/**
* Set target value on entity.
*/
function vocabulary_mapper_set_target(FeedsSource $source, &$entity, $target, array $values, array $mapping) {
$entity->{$target} = reset($values);
}
/**
* Callback for unique_callbacks for test_target mapper.
*/
function vocabulary_mapper_unique(FeedsSource $source, $entity_type, $bundle, $target, array $values) {
$records = db_query("SELECT v.vid FROM {drills_ch_vocabulary} v WHERE v.vocabulary=:voca", array(':voca'=>reset($values)) )->fetchAll();
if(count($records)>0 ) {
return reset($records)->vid ;
}
return false ;
}