5 * Test module for testing the migration source plugin prepareRow() exception
9 use Drupal\migrate\Plugin\MigrationInterface;
10 use Drupal\migrate\MigrateSkipRowException;
11 use Drupal\migrate\Plugin\MigrateSourceInterface;
12 use Drupal\migrate\Row;
15 * Implements hook_migrate_prepare_row().
17 function migrate_prepare_row_test_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
18 // Test both options for save_to_map.
19 $data = $row->getSourceProperty('data');
20 if ($data == 'skip_and_record') {
21 // Record mapping but don't record a message.
22 throw new MigrateSkipRowException('', TRUE);
24 elseif ($data == 'skip_and_dont_record') {
25 // Don't record mapping but record a message.
26 throw new MigrateSkipRowException('skip_and_dont_record message', FALSE);