Support translation entities

Created on 24 May 2022, about 2 years ago
Updated 5 April 2024, 3 months ago

Problem/Motivation

Not replace term in translation entity.

Steps to reproduce

1. Create term1
2. Create term2
3. Create node and add translate another language and set translation reference field term1 value
3. Run \Drupal::service('term_reference_change.migrator') ->migrateReference($term1, $term2);
4. Not replace field value by step3

Proposed resolution

Add support translations entities

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡·πŸ‡ΊRussia batkor Irkutsk

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @batkor thanks a lot! I'm a bit afraid of the array deep merge. Did you test this carefully?

    Would it be possible to have tests for such cases to ensure it works as expected, now and in the future?

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 4 months ago
    12 pass, 2 fail
  • First commit to issue fork.
  • πŸ‡ͺπŸ‡ΈSpain aleix

    Just added kernel tests for the translated nodes that references terms to be merged.

    - Drupal\Tests\term_reference_change\Kernel\ReferenceTranslatedFinderTest::findsReferencingEntities
    - Drupal\Tests\term_reference_change\Kernel\ReferenceTranslatedFinderTest::migrateTranslatedReferencingEntitiesSingle
    - Drupal\Tests\term_reference_change\Kernel\ReferenceTranslatedFinderTest::migrateTranslatedReferencingEntities"original has synonyms"
    - Drupal\Tests\term_reference_change\Kernel\ReferenceTranslatedFinderTest::migrateTranslatedReferencingEntities"translated has synonyms"
    - Drupal\Tests\term_reference_change\Kernel\ReferenceTranslatedFinderTest::migrateTranslatedReferencingEntities"both have synonyms"
    - Drupal\Tests\term_reference_change\Kernel\ReferenceTranslatedFinderTest::migrateTranslatedReferencingEntities"no synonyms"

    The migrateTranslatedReferencingEntities test is a little overkill and may be hard to understand because the logics to accept dataprovider, but it also helps to be sure that things are working in most of the scenarios.
    The migrateTranslatedReferencingEntitiesSingle test is the same but limited to one scenario.
    The findsReferencingEntities just find the referencing entities with terms to be merged.

    All have passed in local, let's see here. So it could be reviewed.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 4 months ago
    12 pass, 2 fail
  • Status changed to Needs work 3 months ago
  • πŸ‡ͺπŸ‡ΈSpain aleix

    As the tests in ci are failing... I'll check asap

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 3 months ago
    13 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 3 months ago
    13 pass
  • Status changed to Needs review 3 months ago
  • πŸ‡ͺπŸ‡ΈSpain aleix

    Finally passing, waiting for review now.

Production build 0.69.0 2024