You are here

migrate_skip_all_rows_test.module in Drupal 10

Test module for testing the migration source plugin prepareRow() exception handling.

File

core/modules/migrate/tests/modules/migrate_skip_all_rows_test/migrate_skip_all_rows_test.module
View source
<?php

/**
 * @file
 * Test module for testing the migration source plugin prepareRow() exception
 * handling.
 */
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\MigrateSourceInterface;
use Drupal\migrate\Row;

/**
 * Implements hook_migrate_prepare_row().
 */
function migrate_skip_all_rows_test_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
  if (\Drupal::state()
    ->get('migrate_skip_all_rows_test_migrate_prepare_row')) {
    throw new MigrateSkipRowException();
  }
}