In OrangeDamMigrationDataManager::getMigrationBySourceId allow for filtering of the migrations to be searched

Created on 2 October 2023, 9 months ago
Updated 19 October 2023, 8 months ago

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.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States apotek

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024