You are here

protected function FeedsProcessor::initEntitiesToBeRemoved in Feeds 7.2

Initializes the list of entities to remove.

This populates $state->removeList with all existing entities previously imported from the source.

Parameters

FeedsSource $source: Source information about this import.

FeedsState $state: The FeedsState object for the given stage.

2 calls to FeedsProcessor::initEntitiesToBeRemoved()
FeedsProcessor::process in plugins/FeedsProcessor.inc
Process the result of the parsing stage.
FeedsUserProcessor::initEntitiesToBeRemoved in plugins/FeedsUserProcessor.inc
Overrides FeedsProcessor::initEntitiesToBeRemoved().
1 method overrides FeedsProcessor::initEntitiesToBeRemoved()
FeedsUserProcessor::initEntitiesToBeRemoved in plugins/FeedsUserProcessor.inc
Overrides FeedsProcessor::initEntitiesToBeRemoved().

File

plugins/FeedsProcessor.inc, line 583
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Code

protected function initEntitiesToBeRemoved(FeedsSource $source, FeedsState $state) {
  $state->removeList = array();

  // We fill it only if needed.
  if ($this->config['update_non_existent'] == FEEDS_SKIP_NON_EXISTENT) {
    return;
  }

  // Get the full list of entities for this source.
  $entity_ids = db_select('feeds_item')
    ->fields('feeds_item', array(
    'entity_id',
  ))
    ->condition('entity_type', $this
    ->entityType())
    ->condition('id', $this->id)
    ->condition('feed_nid', $source->feed_nid)
    ->condition('hash', $this->config['update_non_existent'], '<>')
    ->execute()
    ->fetchCol();
  if (!$entity_ids) {
    return;
  }
  $state->removeList = array_combine($entity_ids, $entity_ids);
}