Problem/Motivation

When calling `OrangeDamMigrationDataManager::getMigrationBySourceId()` there is no means of limiting the migrations to search, which means a lot of migrations which might be completely irrelevant will also be searched.

I propose something like this:

getMigrationBySourceId(array $migration_ids = [], array $migration_tags = [], array $migration_groups = []) {}

But implementing this as the ability to get migrations filtered by ids, tags, or groups requires quite a few modifications upstream, specifically the function `OrangeDamMigrationDataManager::getMigrations()` would need to have more internals. Currently it only supports filtering by tag.

So, I think for now a suitably humble beginning would be to only support filtering by tags, but we'll do it in a way that supports named arguments, so we can support further changes.

So `getMigrationBySourceId()` becomes `getMigrationBySourceId(array migration_tags = [])`.

And getMigrations changes too:

  public function getMigrations(array $migration_tags = []): array {
    if (empty($migration_tags)) {
      $migration_tags = [static::MIGRATION_TAG];
    }
    // Migration Plugin Manager createInstancesByTag only supports single tags.
    $migrations = [];
    foreach ($migration_tags as $tag) {
      $migrations = array_merge($migrations, $this->migrationManager->createInstancesByTag($tag));
    }
    return $migrations;
  }

I'll put something together and see what you think.

Issue fork orange_dam-3390961

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

apotek created an issue. See original summary.

apotek’s picture

Status: Active » Needs review
apotek’s picture

Reviewed. Now testing.

markdorison made their first commit to this issue’s fork.

adamzimmermann’s picture

Status: Needs review » Needs work
markdorison’s picture

Status: Needs work » Needs review
adamzimmermann’s picture

Status: Needs review » Reviewed & tested by the community

markdorison’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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