You are here

protected function ContactSettings::initializeIterator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/contact/src/Plugin/migrate/source/ContactSettings.php \Drupal\contact\Plugin\migrate\source\ContactSettings::initializeIterator()

Implementation of MigrateSource::performRewind().

We could simply execute the query and be functionally correct, but we will take advantage of the PDO-based API to optimize the query up-front.

Overrides Variable::initializeIterator

File

core/modules/contact/src/Plugin/migrate/source/ContactSettings.php, line 23
Contains \Drupal\contact\Plugin\migrate\source\ContactSettings.

Class

ContactSettings
Plugin annotation @MigrateSource( id = "contact_settings", source_provider = "contact" )

Namespace

Drupal\contact\Plugin\migrate\source

Code

protected function initializeIterator() {
  $default_category = $this
    ->select('contact', 'c')
    ->fields('c', [
    'cid',
  ])
    ->condition('selected', 1)
    ->execute()
    ->fetchField();
  return new \ArrayIterator([
    $this
      ->values() + [
      'default_category' => $default_category,
    ],
  ]);
}