Problem/Motivation

When running any migrate command (e.g. drush migrate:status) on a Drupal 11 site that has migrate_drupal enabled, the following error is thrown even if the
d7_pathauto_patterns migration is not being used:

In MigrationPluginManager.php line 118:
  The pathauto_pattern plugin must define the source_module property. 

Steps to reproduce

1. Drupal 11 site with pathauto and migrate_drupal enabled
2. Run drush migrate:status
3. Error is thrown

Root cause

In Drupal 11, PHP 8 attributes take precedence over docblock annotations for plugin discovery. The PathautoPattern source plugin
(src/Plugin/migrate/source/PathautoPattern.php) was partially migrated to use the #[MigrateSource] attribute, but source_module was not carried over:

  // Old annotation (ignored in Drupal 11):
  // @MigrateSource(id = "pathauto_pattern", source_module = "pathauto")                                                                                                        
                                                                                                                                                                                
  // New attribute (missing source_module):                                                                                                                                     
  #[MigrateSource(id: 'pathauto_pattern')]                                                                                                                                      

Drupal\migrate_drupal\MigrationPluginManager::processDefinition() checks for source_module either in the source plugin definition or in the migration's source section. Since
the PHP 8 attribute doesn't include it and the MigrateSource attribute class itself has no source_module parameter, the check fails.

Proposed resolution

Add source_module: pathauto to the source section of migrations/d7_pathauto_patterns.yml:

  source:                                                                                                                                                                       
    plugin: pathauto_pattern
    source_module: pathauto                                                                                                                                                     

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork pathauto-3588684

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

makkus183 created an issue. See original summary.

joegraduate’s picture

Status: Active » Needs review
fchometon’s picture

Works for me on Drupal 11.3.8

pacproduct’s picture

Status: Needs review » Reviewed & tested by the community

Works for me on Drupal 11.3.9.

trebormc’s picture

Confirming the patch works as expected on Drupal core 11.3.9. drush mim runs without errors now. Thanks for the fix!