You are here

protected function FeedsDataProcessor::existingItemId in Feeds 6

Iterate through unique targets and try to load existing records. Return id for the first match.

Overrides FeedsProcessor::existingItemId

1 call to FeedsDataProcessor::existingItemId()
FeedsDataProcessor::process in plugins/FeedsDataProcessor.inc
Implementation of FeedsProcessor::process().

File

plugins/FeedsDataProcessor.inc, line 222
Definition of FeedsDataProcessor.

Class

FeedsDataProcessor
Creates simple table records from feed items. Uses Data module.

Code

protected function existingItemId(FeedsImportBatch $batch, FeedsSource $source) {
  foreach ($this
    ->uniqueTargets($batch) as $target => $value) {
    if ($records = $this
      ->handler()
      ->load(array(
      'feed_nid' => $source->feed_nid,
      $target => $value,
    ))) {
      return $records[0]['id'];
    }
  }
  return FALSE;
}