Unverified Commit 7d1fdd76 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3010951 by quietone, ayushmishra206, sarvjeetsingh, super_romeo,...

Issue #3010951 by quietone, ayushmishra206, sarvjeetsingh, super_romeo, mikelutz, camerongreen, larowlan: createInstancesByTag creates all instances if tag not found
parent e249a9a8
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/migrate/src/Plugin/MigrationPluginManager.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public function createInstancesByTag($tag) {
    $migrations = array_filter($this->getDefinitions(), function ($migration) use ($tag) {
      return !empty($migration['migration_tags']) && in_array($tag, $migration['migration_tags']);
    });
    return $this->createInstances(array_keys($migrations));
    return $migrations ? $this->createInstances(array_keys($migrations)) : [];
  }

  /**
+2 −1
Changes for core/modules/migrate/src/Plugin/MigrationPluginManagerInterface.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -47,7 +47,8 @@ public function createStubMigration(array $definition);
   *   A migration tag we want to filter by.
   *
   * @return array|\Drupal\migrate\Plugin\MigrationInterface[]
   *   An array of migration objects with the given tag.
   *   An array of migration objects with the given tag, or an empty array if no
   *   migrations with that tag exist.
   */
  public function createInstancesByTag($tag);

+7 −0
Changes for core/modules/migrate/tests/modules/migrate_tag_test/migrate_tag_test.info.yml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
name: Migration Tag Test
type: module
description: Provide migrations for testing 'migration_tags' property
package: Testing
version: VERSION
dependencies:
  - drupal:migrate
+16 −0
Changes for core/modules/migrate/tests/modules/migrate_tag_test/migrations/tag_test_0.yml: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
id: tag_test_0
label: migration tag test 0
migration_tags:
  - test
  - tag_test_0
source:
  plugin: embedded_data
  data_rows:
    - id: 0
  ids:
    id:
      type: integer
process:
  id: id
destination:
  plugin: null
+16 −0
Changes for core/modules/migrate/tests/modules/migrate_tag_test/migrations/tag_test_1.yml: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
id: tag_test_1
label: migration tag test 1
migration_tags:
  - test
  - tag_test_1
source:
  plugin: embedded_data
  data_rows:
    - id: 0
  ids:
    id:
      type: integer
process:
  id: id
destination:
  plugin: null
Loading