Occasionally you may need to change up the data as it is migrating from your D6 / D7 site to your D8 site. This is common especially in the case of migrating a Date field.
You can alter a data by extending the ProcessPluginBase and using the transform method.
- You should of run the drush version of custom migration and created a module. We will need to edit one of the config YML files.
- In this case we are changing the node import which is usual identified like: migrate_plus.migration.upgrade_d7_node_YOURTYPE.yml
We are going to change our date field in the yml from:
We are changing the process handler to:
- In your custom migration module create the following folder path: src/Plugin/migrate/process
Create a file in the new folder called FixDate.php and put this code in: