protected function FeedsTermProcessor::existingEntityId in Feeds 7.2
Get id of an existing feed item term if available.
Overrides FeedsProcessor::existingEntityId
File
- plugins/
FeedsTermProcessor.inc, line 222 - FeedsTermProcessor class.
Class
- FeedsTermProcessor
- Feeds processor plugin. Create taxonomy terms from feed items.
Code
protected function existingEntityId(FeedsSource $source, FeedsParserResult $result) {
if ($tid = parent::existingEntityId($source, $result)) {
return $tid;
}
// The only possible unique target is name.
foreach ($this
->uniqueTargets($source, $result) as $target => $value) {
if ($target == 'name') {
$vocabulary = $this
->vocabulary();
if ($tid = db_query("SELECT tid FROM {taxonomy_term_data} WHERE name = :name AND vid = :vid", array(
':name' => $value,
':vid' => $vocabulary->vid,
))
->fetchField()) {
return $tid;
}
}
}
return 0;
}