protected function FeedsTermProcessor::existingEntityId in Feeds 8.2
Get id of an existing feed item term if available.
Overrides FeedsProcessor::existingEntityId
File
- lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsTermProcessor.php, line 200 - FeedsTermProcessor class.
Class
- FeedsTermProcessor
- Defines a taxonomy term processor.
Namespace
Drupal\feeds\Plugin\feeds\processorCode
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') {
if ($tid = db_query("SELECT tid FROM {taxonomy_term_data} WHERE name = :name AND vid = :vid", array(
':name' => $value,
':vid' => $this
->bundle(),
))
->fetchField()) {
return $tid;
}
}
}
return 0;
}