You are here

public function CleanState::setList in Feeds 8.3

Sets the list of entity ID's.

Parameters

array $ids: An array of entity ID's.

Overrides CleanStateInterface::setList

File

src/Feeds/State/CleanState.php, line 92

Class

CleanState
State for the clean stage.

Namespace

Drupal\feeds\Feeds\State

Code

public function setList(array $ids) {

  // Remove previous list first.
  $this->connection
    ->delete(static::TABLE_NAME)
    ->condition('feed_id', $this->feedId)
    ->execute();

  // Insert the list into the database.
  if (!empty($ids)) {
    $query = $this->connection
      ->insert(static::TABLE_NAME)
      ->fields([
      'feed_id',
      'entity_id',
    ]);
    foreach ($ids as $id) {
      $query
        ->values([
        'feed_id' => $this->feedId,
        'entity_id' => $id,
      ]);
    }
    $query
      ->execute();
  }

  // Set flag that initiating is done.
  $this->initiated = TRUE;
}