X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate%2Fsrc%2FPlugin%2Fmigrate%2Fprocess%2FIterator.php;h=4878ad45f1fb98554990c28c5ae499b4a913100c;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=d85abfdb3b8ded1e09fc4d61bd0c2e0ca0987b2e;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/migrate/src/Plugin/migrate/process/Iterator.php b/web/core/modules/migrate/src/Plugin/migrate/process/Iterator.php index d85abfdb3..4878ad45f 100644 --- a/web/core/modules/migrate/src/Plugin/migrate/process/Iterator.php +++ b/web/core/modules/migrate/src/Plugin/migrate/process/Iterator.php @@ -2,65 +2,19 @@ namespace Drupal\migrate\Plugin\migrate\process; -use Drupal\migrate\ProcessPluginBase; -use Drupal\migrate\MigrateExecutableInterface; -use Drupal\migrate\Row; +@trigger_error('The ' . __NAMESPACE__ . '\Iterator is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.0. Instead, use ' . __NAMESPACE__ . '\SubProcess', E_USER_DEPRECATED); /** - * This plugin iterates and processes an array. + * Iterates and processes an associative array. * - * @link https://www.drupal.org/node/2135345 Online handbook documentation for iterator process plugin @endlink + * @deprecated in Drupal 8.4.x and will be removed in Drupal 9.0.x. Use + * \Drupal\migrate\Plugin\migrate\process\SubProcess instead. + * + * @see https://www.drupal.org/node/2880427 * * @MigrateProcessPlugin( * id = "iterator", * handle_multiples = TRUE * ) */ -class Iterator extends ProcessPluginBase { - - /** - * Runs a process pipeline on each destination property per list item. - */ - public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - $return = []; - if (!is_null($value)) { - foreach ($value as $key => $new_value) { - $new_row = new Row($new_value, []); - $migrate_executable->processRow($new_row, $this->configuration['process']); - $destination = $new_row->getDestination(); - if (array_key_exists('key', $this->configuration)) { - $key = $this->transformKey($key, $migrate_executable, $new_row); - } - $return[$key] = $destination; - } - } - return $return; - } - - /** - * Runs the process pipeline for the current key. - * - * @param string|int $key - * The current key. - * @param \Drupal\migrate\MigrateExecutableInterface $migrate_executable - * The migrate executable helper class. - * @param \Drupal\migrate\Row $row - * The current row after processing. - * - * @return mixed - * The transformed key. - */ - protected function transformKey($key, MigrateExecutableInterface $migrate_executable, Row $row) { - $process = ['key' => $this->configuration['key']]; - $migrate_executable->processRow($row, $process, $key); - return $row->getDestinationProperty('key'); - } - - /** - * {@inheritdoc} - */ - public function multiple() { - return TRUE; - } - -} +class Iterator extends SubProcess {}