The "null" migration destination plugin can't be used

Created on 1 March 2017, over 7 years ago
Updated 23 May 2024, about 1 month ago

I'm trying to write a migration that creates a stub using the migration process plugin, but doesn't actually use a destination plugin. Since it's not valid to omit the destination phase completely, I noticed there is a destination plugin called "null" which does exactly what I need at \Drupal\migrate\Plugin\migrate\destination\NullDestination.

The problem is that its annotation contains the line requirements_met = false. Any attempts to use it cause an error that "Migration X did not meet the requirements". The only way I could find to avoid this was to create my own plugin which is a subclass of "null", but omits requirements_met = false in the annotation.

Why is this line present? Is it intentional?

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡ΊπŸ‡ΈUnited States Gribnif

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom joachim

    > The null destination plugin is intended to throw errors and not meet requirements.

    Is it for tests? If so, that should be in a test module, and with a clearer name too.

    A dev/null destination plugin is useful for developing migrations, so the 'null' destination should be made usable -- I filed ✨ add a null destination Needs review because I hadn't realised this class existed in core.

    My use case was that I was trying to understand how to get data from a source that was a large set of XML files, in structured folders. I wanted to check that my configuration of the Url and XML source plugins (from Migrate Plus module) was working, and to see how much custom code I would have to do. To do this, I needed to run the migration and see the data (with Migrate Devel module's debugging options for Drush). But I didn't want to have to set up a real destination -- partly because that would be extra work, and also because I'd then keep having to roll back to run the migration again, because the map would get saved. So a null destination was exactly what I need -- it allows the migration to be run, does nothing with the data, so you can run it over and over again while you develop iteratively.

  • πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝

    I agree that there's a use case for a "null-ish" destination - I often use something like Gold's Noop extension of core's Null destination plugin from #11 above if I want to debug a process plugin on the CLI.

    The Migrate Sandbox β†’ module might be another option, but to me it makes sense to have the option of a destination plugin that permits debugging sources and processes without needing any destination configuration or resulting in local content output.

    Anyway, I'm here to +1 the idea of making this destination a living thing, if that works!

  • πŸ‡¦πŸ‡ΉAustria mvonfrie

    +1 for me as well.

    I have similar use cases as @joachim.

    My first use case is developing a migration from D7 Scald (using the migrate_source_scald_atom source which is completely undocumented and drush migrate:fields-source not really a help) to D10 Media.

    My second use case is migrating user memberships from D7 organic groups to D10 groups, but I can't migrate the organic groups to groups as well. So I have to write a custom source plugin which reads the membership relations from the D7 database together with the D10 group UUIDs which will be added in the D7 instance. It is a bit too complicated to explain why we can't migrate organic groups to groups, lets simply say there are too big structural changes and the customer decided to use the migration to implement organizational changes already existing in real-life as well.

    For both use cases it is really helpful to have a destination which doesn't create any data in the site until the plugins and migrations are ready and the real destination plugins can be used.

Production build 0.69.0 2024