Problem/Motivation

in Drupal 8 there was a Migration::get() method. It was appropriately deprecated but I missed that It was being used in Migrate Manifest to bypass the lack of an accessor for listing requirements. Since it is removed in Drupal 9 and there is not replacement, Migrate Manifest is not currently able to upgrade.

Proposed resolution

Add a "getRequirements()" method to Migration class and the MigrationsInterface

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neclimdul created an issue. See original summary.

neclimdul’s picture

Status: Active » Needs review
FileSize
1 KB

MigrationInterface might not actually be the right place. Here's a patch with the method on RequirementsInterface.

neclimdul’s picture

yeah... nope. That's going to fail hard. Requirements interface has a bunch of different contexts its used in and most can't list plugin ids. Going to have to be specific to migrations.

neclimdul’s picture

Lets see how testbot feels about this.

dinarcon’s picture

Thanks for getting a fix started @neclimdul. This is also affecting the --execute-dependencies flag in Migrate Tools and (probably) Migrate Run. Referencing a related issue where adding a new interface is mentioned.

neclimdul’s picture

Issue tags: -Needs tests
FileSize
1.84 KB

I knew that looked too clever and I didn't remember writing it. I'm sure I stole the idea from Migrate Tools. :-D

Here's a patch with tests. The method doesn't really do much so the test is pretty trivial.

neclimdul’s picture

+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -420,6 +420,13 @@ public function getIdMap() {
+   * {@inheritDoc}}

You know, sometimes you don't see things until you see it in the patch review...
}}

Sorry for being lazy about the interdiffs, I have a couple patches i'm working on in the same branch so its a pain. #6 just added the tests. This just fixes the }} in the doc.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Easy enough change here. +1.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

I think this is allowed under our 1-1 interface to class rule - but given we're adding a method to an interface I think we should have a change record.

+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -420,6 +420,13 @@ public function getIdMap() {
+  public function getRequirements() {

+++ b/core/modules/migrate/src/Plugin/MigrationInterface.php
@@ -103,6 +103,13 @@ public function id();
+  public function getRequirements();

To prevent future re-work let's add a return typehint. Yes the mix of methods without a return hint and ones with is meh but if adding new things without out this is adding to future work.

quietone’s picture

Status: Needs work » Needs review
Issue tags: +Bug Smash Initiative
FileSize
958 bytes
1.86 KB

#10 Added a CR and here is a patch with the return type declarations.

neclimdul’s picture

+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -417,6 +417,13 @@ public function getIdMap() {
+  public function getRequirements() : array {

+++ b/core/modules/migrate/src/Plugin/MigrationInterface.php
@@ -103,6 +103,13 @@ public function id();
+  public function getRequirements(): array;

I'm not sure what our code style for return types is but I assume the spacing on these should be consistent?

quietone’s picture

I couldn't find anything for return types in the coding standards but grep shows the convention is the second one, public function getRequirements(): array;. Updated the patch accordingly.

There is a change record, so removing tag.

neclimdul’s picture

Status: Needs review » Reviewed & tested by the community

awesome. I think this can go back to RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: 3154398-12.patch, failed testing. View results

heddn’s picture

Status: Needs work » Reviewed & tested by the community

  • larowlan committed 90c7d4c on 9.1.x
    Issue #3154398 by neclimdul, quietone, alexpott: Migrations don't have...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed 90c7d4c and pushed to 9.1.x. Thanks!

Published the change-record.

Didn't backport this because there's an outside chance of disruption.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.