Version 1
[yaffs-website] / web / core / modules / migrate / tests / modules / migrate_prepare_row_test / src / Plugin / migrate / process / TestSkipRowProcess.php
1 <?php
2
3 namespace Drupal\migrate_prepare_row_test\Plugin\migrate\process;
4
5 use Drupal\migrate\MigrateExecutableInterface;
6 use Drupal\migrate\MigrateSkipRowException;
7 use Drupal\migrate\ProcessPluginBase;
8 use Drupal\migrate\Row;
9
10 /**
11  * Provides a testing process plugin that skips rows.
12  *
13  * @MigrateProcessPlugin(
14  *   id = "test_skip_row_process"
15  * )
16  */
17 class TestSkipRowProcess extends ProcessPluginBase {
18
19   /**
20    * {@inheritdoc}
21    */
22   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
23     // Test both options for save_to_map.
24     $data = $row->getSourceProperty('data');
25     if ($data == 'skip_and_record (use plugin)') {
26       throw new MigrateSkipRowException('', TRUE);
27     }
28     elseif ($data == 'skip_and_dont_record (use plugin)') {
29       throw new MigrateSkipRowException('', FALSE);
30     }
31     return $value;
32   }
33
34 }