Problem/Motivation

#2911244: Field collections deriver and base migration made migrating Paragraphs from Drupal 7 to Drupal 9 much simpler. (Although per #3178043-4: Experience report: migrating D7 field collections to D8 paragraphs — we should also land #3145755: Orphaned (nested) paragraphs entities after migration & (invalid) stub paragraph entity leftovers so we can start labeling it "mostly easy" — it still is pretty hard.)

On January 11, #2565931-112: Handle long comment bundle names was committed to 9.1.x and 9.2.x. Ever since then, the already-failing Paragraphs tests on Drupal 9.2 started failing much more severely:

The root cause: #2565931: Handle long comment bundle names modifies core/modules/field/migrations/d7_field_instance.yml's process pipeline for 'bundle' and #2911244: Field collections deriver and base migration introduced the Paragraphs module modifying that very same process pipeline in the migration definition, in \Drupal\paragraphs\MigrationPluginsAlterer::paragraphsMigrationBundleAdjust(), which does:

  public function paragraphsMigrationBundleAdjust(array &$migration) {
    if (!self::paragraphsMigrationPrepareProcess($migration['process'], 'bundle_mapped')) {
      return;
    }

    $bundle_process = &$migration['process']['bundle_mapped'];
    $bundle_process[] = [
      'plugin' => 'paragraphs_process_on_value',
      'source_value' => 'entity_type',
      'expected_value' => 'field_collection_item',
      'process' => [
        'plugin' => 'substr',
        'start' => FieldCollection::FIELD_COLLECTION_PREFIX_LENGTH,
      ],
    ];
  }

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

Wim Leers’s picture

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

#3 still has 4 test failures on 9.1 and 9.2, but they're the ones from before #2565931: Handle long comment bundle names.

So, being bold and self-RTBC'ing 🤓

rozh’s picture

+1 for RTBC. Patch #3 works for me. Drupal 9.1.5, migration executed with Drush.

huzooka’s picture

davedg629’s picture

Patch #3 won't apply for me (D9.1.8 & Paragraphs 8.x-1.12). Am I doing something wrong or is that by design due to the tests that are still failing? Sorry, I'm a n00b.

huzooka’s picture

Maybe it's because https://www.drupal.org/project/paragraphs/issues/2911244 isn't released yet?

davedg629’s picture

Ok, but it looks like others were able to apply the patch and I'd like to know how they did that.

Do I first need to apply the patch from this issue? #3145755: Derive Field Collection and Paragraph entity migrations based on their parent entity type ID (and parent entity bundle)

Edit: Was able to get this patch applied by applying the above mentioned patch first.

My issue is with also trying to apply the patch from this issue: https://www.drupal.org/project/paragraphs/issues/2977853. Looks like further work needs to be done on that patch like was done on #3145755: Derive Field Collection and Paragraph entity migrations based on their parent entity type ID (and parent entity bundle) to make it compatible with the patch in this issue.

MariaIoann’s picture

Patch #3 worked for me with Drupal Core 9.1.9 and Paragraphs 8.1.x-dev and w/o any other Paragraphs patch applied.
The following snippet is produced for a field_foo paragraph field, with migrate-upgrade after applying the patch:

field_foo:
    -
      plugin: sub_process
      source: field_foo
      process:
        target_id:
          -
            plugin: paragraphs_lookup
            tags: 'Field Collection Content'
            source: value
          -
            plugin: extract
            index:
              - id
        target_revision_id:
          -
            plugin: paragraphs_lookup
            tags:
              - 'Field Collection Revisions Content'
              - 'Field Collection Content'
            tag_ids:
              'Field Collection Revisions Content':
                - revision_id
              'Field Collection Content':
                - value
          -
            plugin: extract
            index:
              - revision_id
huzooka’s picture

#3226658: Guarantee the uniqueness of the migrated paragraph types fixes this issue as well (and a bit more as well).

Berdir’s picture

Status: Reviewed & tested by the community » Fixed

Slightly confusing but I think #3 is the patch to commit, did that.

  • Berdir committed 185a297 on 8.x-1.x authored by huzooka
    Issue #3203739 by Wim Leers, huzooka: Paragraphs migrations broken in...

Status: Fixed » Closed (fixed)

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