class Iterator in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/Plugin/migrate/process/Iterator.php \Drupal\migrate\Plugin\migrate\process\Iterator
This plugin iterates and processes an array.
Plugin annotation
@MigrateProcessPlugin(
id = "iterator",
handle_multiples = TRUE
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
- class \Drupal\migrate\ProcessPluginBase implements MigrateProcessInterface
- class \Drupal\migrate\Plugin\migrate\process\Iterator
- class \Drupal\migrate\ProcessPluginBase implements MigrateProcessInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
Expanded class hierarchy of Iterator
See also
https://www.drupal.org/node/2135345
1 file declares its use of Iterator
- IteratorTest.php in core/
modules/ migrate/ tests/ src/ Unit/ process/ IteratorTest.php - Contains \Drupal\Tests\migrate\Unit\process\IteratorTest.
7 string references to 'Iterator'
- DoublerSpec::its_double_mirrors_alterates_and_instantiates_provided_class in vendor/
phpspec/ prophecy/ spec/ Prophecy/ Doubler/ DoublerSpec.php - Framework_MockObjectTest::traversableProvider in vendor/
phpunit/ phpunit-mock-objects/ tests/ MockObjectTest.php - PHPUnit_Framework_MockObject_Generator::generateMock in vendor/
phpunit/ phpunit-mock-objects/ src/ Framework/ MockObject/ Generator.php - PHPUnit_Framework_MockObject_Generator::getMock in vendor/
phpunit/ phpunit-mock-objects/ src/ Framework/ MockObject/ Generator.php - Returns a mock object for the specified class.
- TraversablePatch::apply in vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ ClassPatch/ TraversablePatch.php - Forces class to implement Iterator interface.
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ process/ Iterator.php, line 24 - Contains \Drupal\migrate\Plugin\migrate\process\Iterator.
Namespace
Drupal\migrate\Plugin\migrate\processView source
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 = array();
foreach ($value as $key => $new_value) {
$new_row = new Row($new_value, array());
$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 = array(
'key' => $this->configuration['key'],
);
$migrate_executable
->processRow($row, $process, $key);
return $row
->getDestinationProperty('key');
}
/**
* {@inheritdoc}
*/
public function multiple() {
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
Iterator:: |
public | function |
Indicates whether the returned value requires multiple handling. Overrides ProcessPluginBase:: |
|
Iterator:: |
public | function |
Runs a process pipeline on each destination property per list item. Overrides ProcessPluginBase:: |
|
Iterator:: |
protected | function | Runs the process pipeline for the current key. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 2 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Constructs a Drupal\Component\Plugin\PluginBase object. | 69 |
StringTranslationTrait:: |
protected | property | The string translation service. | |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |