The https://www.drupal.org/project/migrate_tools/issues/3024399#comment-1333... commit broke the --execute-dependencies option.

$migration->get('requirements');

is not the same as

$definition = $migration->getPluginDefinition();
$required_migrations = $definition['requirements'] ?? [];

The requirements property is built and set in the \Drupal\migrate\Plugin\MigrationPluginManager::createInstances function.

Trying to follow the reason behind the change leads to this.

Since there's no interface method available to retrieve that property, the only viable solution is to use MigrationInterface::getMigrationDependencies(), and build a similar list of dependency ids.

Comments

codebymikey created an issue. See original summary.

codebymikey’s picture

Title: The "--execute-dependencies" option is currently broken due to the deprecation of the "get('requirements')" function » The "--execute-dependencies" option is currently broken due to the deprecation of the "get('requirements')" method
Version: 8.x-5.x-dev » 8.x-4.x-dev
Status: Active » Needs work
Related issues: +#2694009: MigrationInterface doesn't include get()
StatusFileSize
new1.87 KB

I've provided an initial patch to keep the existing functionality.

A better implementation is needed for Drupal 9 support.

csmdgl’s picture

I can confirm that the patch worked for me.

heddn’s picture

Issue tags: +Needs tests

Obviously this could use some tests. And I we might need to go back to core and ask for an interface in D9 that provides the dependencies. I don't think a reflection based approach is very sustainable. Meaning, its ugly.

neclimdul’s picture

core patch posted and ready for some review. its pretty trivial #3154398: Migrations don't have an accessor for requirements

heddn’s picture

Status: Needs work » Closed (duplicate)

The great gitlab migration is upon us. See https://gitlab.com/drupalspoons/migrate_tools/-/issues/93. The latest patch from #2 has been uploaded to https://gitlab.com/drupalspoons/migrate_tools/-/merge_requests/5

marcelovani’s picture

The PR works, left a comment there.