You are here

protected function FeedsFeedNodeProcessor::existingItemId in Feeds 7

Same name and namespace in other branches
  1. 6 plugins/FeedsFeedNodeProcessor.inc \FeedsFeedNodeProcessor::existingItemId()

Get nid of an existing feed item node if available.

Overrides FeedsProcessor::existingItemId

1 call to FeedsFeedNodeProcessor::existingItemId()
FeedsFeedNodeProcessor::process in plugins/FeedsFeedNodeProcessor.inc
Implements FeedsProcessor::process().

File

plugins/FeedsFeedNodeProcessor.inc, line 199
Class definition of FeedsFeedNodeProcessor.

Class

FeedsFeedNodeProcessor
Creates *feed* nodes from feed items. The difference to FeedsNodeProcessor is that this plugin only creates nodes that are feed nodes themselves.

Code

protected function existingItemId(FeedsImportBatch $batch, FeedsSource $source) {

  // We only support one unique target: source
  foreach ($this
    ->uniqueTargets($batch) as $target => $value) {
    if ($target == 'source') {
      return db_query("SELECT fs.feed_nid FROM {node} n JOIN {feeds_source} fs ON n.nid = fs.feed_nid WHERE fs.id = :id AND fs.source = :source", array(
        ':id' => $this
          ->feedNodeImporter()->id,
        ':source' => $value,
      ))
        ->fetchField();
    }
  }
  return 0;
}