For my custom migration, I tried using the migmag_lookup plugin, since the Drupal core migration_lookup does not work as intended for me.
However, when using this plugin I get the following error:
PHP Fatal error: Trait 'Drupal\migrate_drupal\MigrationConfigurationTrait' not found in /app/web/modules/contrib/migmag/migmag_process/src/Plugin/migrate/process/MigMagLookup.php on line 123
By enabling the migrate_drupal module, this error is resolved. However this module was not enabled in my case, since my migrations do not use Drupal as a source.
It seems it would be to more user friendly to add migrate_drupal as a dependency in the relevant (sub)modules' .info.yml file - at least the ones that use logic from that module.
Obviously the core migrate module could also be added as a module dependency, which is currently not the case, but it wouldn't make much sense to use migmag without it, whereas using migmag without migrate_drupal is a perfectly fine use case.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | migmag-lookup_trait_not_found-3294768--13--complete.patch | 5.47 KB | huzooka |
| #13 | migmag-lookup_trait_not_found-3294768--13--test-only.patch | 996 bytes | huzooka |
Comments
Comment #2
svendecabooterActually, using migmag without migrate_drupal is probably not a valid use case after all.
In my case I am using a JSON data source (via migrate_plus contrib module), and wanted better stubbing logic than the default migration_lookup provides.
But it seems migmag_lookup assumes a database source for the migration, so does not work for me.
Might be good to document that this is a requirement, as I did not understand that from the doc page at https://www.drupal.org/docs/contributed-modules/migrate-magician/migrate...
Comment #3
codebymikey commentedRecently ran into this bug myself while importing a custom
JSON linessource using migrate_plus's API, the core issues this module solves relating to stubs is pretty useful irrespective of the source and it'd be nice if it worked with non-database sources as well, good to know though.Comment #4
huzookaTbh I should reevaluate why I though I need Migrate Drupal here… or why I am using it.
Comment #5
huzookaLet's see what's going on here...
Comment #6
huzookaThis is the test-only patch. It took a while figuring out why
Drupal\migrate_drupal\MigrationConfigurationTraitwas available during testing while on a "real" environment it shouldn't be loadable... It happens because of this: #2006476: Strengthen tests by not autoregistering non-test namespaces of disabled modules.I spent my yesterday exploring and understanding the problem, and I also published a workaround: Test Classmap Cleanup (for PHPUnit tests)
@svendecabooter, I hope that the attached test-only patch will make the lookup test fail with the same error what you have... Let's see!
Comment #7
huzookaLet's change the status to NW!
Comment #8
huzookaThe fix-only patch is the inderdiff between #6 and #8
Comment #10
huzooka🧐
Comment #11
huzookaTheme related failure of
MigMagKernelTestDxTraitTestwill be fixed in #3300629: Handle different (new) default themes in Drupal core 9.5+.Comment #12
huzookaLet's wait for #3300629: Handle different (new) default themes in Drupal core 9.5+.
Comment #13
huzookaTest only patch should be identical to #6, complete patch must be identical to #11.
Comment #16
huzooka🥳