I've written a custom migrate module in Drupal 8. (Based on these instructions: https://github.com/wunderkraut/migrate_source_example/)

The migration reads data from a XML file with the "migrate_source_xml" extension and should write/update the data in a node.

I have a yml config file in /config/install/ and some logic in /src/migrate/source/

When I run the migration with "drush mi --all" I get the correct values in my prepareRow function. Unfortunately, no nodes were create and I get the message "Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored)"

With the prepareRow function I'm able to stop the script at this position. But how can I debug the script afterwards? Does exist a postImport function or something similar?

How do you test your D8 migrations?

Thank you very much for your inputs!

1 Answer 1


The place you want to step through is the while loop in MigrateExecutable::import() - this is where each source row is received after prepareRow(), run through the processing pipeline ($this->processRow), and saved to the destination plugin ($destination->import()).

  • Thank you for your answer. I've tested the migration and I've found the problem. In SourcePluginBase.php#L239 the if statement fails because of the aboveHighwater and rowChanged check (both are NULL). Therefore, the "currentRow" value is NULL and the import fails at MigrateExecutable.php#L217 Do you know what the reason could be?
    – marco-s
    May 24, 2016 at 8:40
  • Is ($destination->import()) still relevant? I can't find it in my code base (Migrate 8.x.4.2)
    – sea26.2
    May 17, 2020 at 18:46
  • It's still in the latest 8.x development branch (8.9.x): git.drupalcode.org/project/drupal/-/blob/8.9.x/core/modules/…
    – Mike Ryan
    May 18, 2020 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.