Problem/Motivation

If the Drupal 7 site uses the telephone field module the new migrated Drupal 8 site should also have a telephone field with the same content.
The Drupal 7 module https://www.drupal.org/project/telephone

CommentFileSizeAuthor
#44 3005969-44.patch19.17 KBquietone
#44 interdiff-42-44.txt2.62 KBquietone
#42 3005969-42.patch19.17 KBlongwave
#41 3005969-32.patch16.95 KBquietone
#41 diff-32-41.txt6.08 KBquietone
#38 3005969-38.patch19.13 KBayushmishra206
#38 interdiff_36-38.txt680 bytesayushmishra206
#36 3005969-36.patch19.12 KBayushmishra206
#36 interdiff_32-36.txt2.74 KBayushmishra206
#32 3005969-32.patch16.94 KBlongwave
#28 3005969-28.patch16.94 KBquietone
#28 interdiff-25-28.txt654 bytesquietone
#26 3005969-25.patch16.3 KBlongwave
#22 drupal-telephone-migration-8.9.3-3005969-22.patch1.37 KBgbirch
#21 3005969-21-8.8.patch15.97 KBtstoeckler
#21 3005969-21.patch16 KBtstoeckler
#21 3005969-19-21-interdiff.txt1.23 KBtstoeckler
#19 3005969-18-8.8.patch15.67 KBtstoeckler
#19 3005969-18.patch15.7 KBtstoeckler
#19 3005969-15-18-interdiff.txt681 byteststoeckler
#15 3005969-15-8.8.patch15.21 KBtstoeckler
#15 3005969-15.patch15.24 KBtstoeckler
#15 3005969-15-test-only.patch15.24 KBtstoeckler
#15 3005969-13-15-test-interdiff.txt1.67 KBtstoeckler
#15 3005969-13-15-interdiff.txt566 byteststoeckler
#14 3005969-13-8.8.patch15.07 KBtstoeckler
#13 3005969-13.patch15.1 KBtstoeckler
#13 3005969-10-13-interdiff.txt1.51 KBtstoeckler
#10 3005969-10.patch14 KBtstoeckler
#10 3005969-9-10--interdiff.txt12.83 KBtstoeckler
#10 3005969-9-reroll.patch2.14 KBtstoeckler
#9 drupal-add-telephone-migration-3005969-9.patch2.13 KBgbirch
#7 3005969-7.patch2.13 KBzaporylie
#4 3005969-2.patch851 bytesAnte890
#2 3005969-2.patch510 bytesAnte890
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ante890 created an issue. See original summary.

Ante890’s picture

Deleted comment

Ante890’s picture

Ante890’s picture

I made a patch that worked for me

zaporylie’s picture

Status: Active » Needs work
zaporylie’s picture

Version: 8.6.1 » 8.8.x-dev
zaporylie’s picture

Status: Needs work » Needs review
FileSize
2.13 KB

Attempt to fix tests by including the telephone>telephone migration in migration tests.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

gbirch’s picture

Re-roll of patch #7 against 8.7.x in hopes it will apply cleanly.

For anyone who gets here as puzzled as I, in the "extra" section of your composer file you must add:

        "patchLevel": {
            "drupal/core": "-p2"
        },

To force the patch to be applied to the right place. Sorry for the confusion.

tstoeckler’s picture

Nice work! I have been working on this, as well. I guess at this point this needs to go into 9.1.x, so first of all I rerolled the patch.

Secondly, here's a review of the patch:

  1. +++ b/core/modules/telephone/src/Plugin/migrate/field/d7/TelephoneField.php
    @@ -0,0 +1,29 @@
    + *   type_map = {
    + *     "telephone" = "telephone",
    + *   },
    

    This is not necessary if the field type matches in D7 and D8.

  2. +++ b/core/modules/telephone/src/Plugin/migrate/field/d7/TelephoneField.php
    @@ -0,0 +1,29 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function getFieldFormatterMap() {
    +    return [
    +      'phone' => 'basic_string',
    +    ];
    +  }
    

    This is leftover from the Phone migration and should be removed.

I fixed those things and also added specific test coverage for the telephone module upgrade. Would love some reviews. If people here can review my test coverage then maybe we can collectively RTBC, because I RTBC the rest (barring the nitpicks above) as I came up with the nearly identical code when testing locally.

The last submitted patch, 10: 3005969-9-reroll.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 10: 3005969-10.patch, failed testing. View results

tstoeckler’s picture

+++ b/core/modules/telephone/migrations/state/telephone.migrate_drupal.yml
@@ -1,3 +1,4 @@
+    telephone: telephone

For anyone following along at home: I was previously wondering why the previous patch didn't contain this hunk. I guess something changed in the test coverage in the meantime because this hunk is what makes the rerolled patch pass the tests.

Also fixes the remaining tests.

tstoeckler’s picture

Re-rolled for 8.8

tstoeckler’s picture

So the previous patch was missing a formatter mapping. In D7 we have text_plain which maps to string in D8. Note that I found #3130240: Some field plugins declare an invalid default widget and formatter which is confusing (but should not impact this patch directly).

In order to provide some test coverage I configured the text_plain formatter to be used in the teaser view mode. Unfortunately, that doesn't make Upgrade7Test fail, so uploading only that change separately to see if it fails any other test that I missed.

The last submitted patch, 15: 3005969-15.patch, failed testing. View results

The last submitted patch, 15: 3005969-15-test-only.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 15: 3005969-15-8.8.patch, failed testing. View results

tstoeckler’s picture

So the test-only patch in #15 nicely failed how it should, so this now includes the test-interdiff from above (in addition to the regular interdiff).

It also fixes the failure in FieldDiscoveryTest (see the new interdiff from this comment) so it should be green.

Status: Needs review » Needs work

The last submitted patch, 19: 3005969-18-8.8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tstoeckler’s picture

Status: Needs work » Needs review
Issue tags: -Needs migration
FileSize
1.23 KB
16 KB
15.97 KB

Not exactly sure why I didn't see this failure earlier, in particular in #15, but this should fix the remaining failure. (Not attaching a separate interdiff for the 8.8.x patch, it's identical, but for the different number of entity view displays.)

gbirch’s picture

Neither the 8.8 nor 9.1 patches apply to 8.9. It is quite tedious to re-roll the whole patch, and does not seem worth doing given the move to Drupal 9. So for anyone who needs the functionality in the short term, this patch contains the functional portions of the master and applies against 8.9.x (8.9.3 as I write).

Status: Needs review » Needs work

The last submitted patch, 22: drupal-telephone-migration-8.9.3-3005969-22.patch, failed testing. View results

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

quietone’s picture

Component: telephone.module » migration system
Category: Feature request » Task

This is the first time I have seen this. There are tests in MigrateField and MigrateFieldInstance test for telephone fields so this may already be done. It requires some investigation.

This is a task because telephone is in core now and moving to the migration system where all things migrate live.

longwave’s picture

Status: Needs work » Needs review
FileSize
16.3 KB

Rerolled #21 for 9.2.x. Some of the migrate tests fail for me locally, but they also fail without this patch, not sure why - let's see what testbot thinks.

Status: Needs review » Needs work

The last submitted patch, 26: 3005969-25.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
654 bytes
16.94 KB

I went ahead and fixed the test but I am still not sure we need this. Will come back to this after the migrate meeting.

longwave’s picture

@quietone this is still needed, I am migrating a D7 site that uses Telephone fields (as opposed to Phone which is supported already), and without this patch the field instance fails to migrate.

quietone’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

@longwave, ah, thanks. I see now. So, both phone and telephone moved to core?

This needs a reroll.

tstoeckler’s picture

Re #30: If I remember correctly, the history is as follows: First there was only Phone module for D7. Then that functionality got moved into D8 as the D8 telephone module and with some slightly different IDs for formatters, etc. And then someone backported the core telephone module and created the D7 Telephone module with the identical IDs as the D8 one. So "newer" D7 sites would have probably used D7 Telephone module (vs. Phone) in the hopes of better D8 compatibility (somewhat ironically, given this issue).

I think (though am not sure) that the backport, i.e. the creation of the D7 Telephone module happened after there was already a migration for the Phone module in place, but in any case it is missing. I assume it was just an oversight, because people thought that we do not need a migration because the IDs are the same.

longwave’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
16.94 KB

Rerolled.

quietone’s picture

@tstoeckler, thank you for the history. I've added this to my list to review. Should get to it early next week.

Also adding this to the D7 meta.

quietone’s picture

Status: Needs review » Needs work

Does Wednesday count as early in the week?

Just a few more items and this will be ready.

+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
@@ -241,6 +241,9 @@ public function addAllFieldProcessesAltersData() {
+                  'text_plain' => 'string',

Shouldn't 'string' be 'basic_string'. In Telephone, telephone_field_info also defines 'telephone_link' so another line is needed,
'telephone_link' => 'basic_string'

This also needs two additional assertions, one in \d7\MigrateFieldInstanceWidgetSettingsTest, and one in d7/MigrateFieldFormatterSettingsTest.php, both are an assertComponent at the end of the tests for the test_content_type,

ayushmishra206’s picture

Assigned: Unassigned » ayushmishra206

Working on this.

ayushmishra206’s picture

Assigned: ayushmishra206 » Unassigned
Status: Needs work » Needs review
FileSize
2.74 KB
19.12 KB

Made the changes suggested in #34. Please review. Thanks.

quietone’s picture

Status: Needs review » Needs work

@ayushmishra206, thanks for working on this. Instead of letting drupalci run the checks on the code, you can do it locally. Running core development checks (>= 9.2.x) has all the instructions.

ayushmishra206’s picture

Status: Needs work » Needs review
FileSize
680 bytes
19.13 KB

@quietone Thanks for telling me this, I'll keep this in mind moving forward. I have made the changes causing the fail and tested it as well.

Status: Needs review » Needs work

The last submitted patch, 38: 3005969-38.patch, failed testing. View results

quietone’s picture

@ayushmishra206, thanks. Like the commit-code-check running the tests locally helps everyone. Some of the errors could have been fixed if you ran the tests locally. See https://www.drupal.org/docs/automated-testing/phpunit-in-drupal/running-.... And one of the error would have been picked up if you are using an IDE. I use PhpStorm and it complains loudly (visually) when the number of parameters doesn't match the method signature.

Now, for the reported errors I started with FieldDiscoveryTest. That need to be sorted before the others.

  1. I think the problem is that the first part of #34 was missed.
    +++ b/core/modules/telephone/src/Plugin/migrate/field/d7/TelephoneField.php
    @@ -0,0 +1,35 @@
    +      'text_plain' => 'string',
    
        return [
          'text_plain' => 'basic_string',
          'telephone_link' => 'telephone_link',
        ];

    string needs to be basic_string and a line for the telephone link is needed.

  2. Now for the migration tests
    +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php
    @@ -178,6 +178,7 @@ public function testMigration() {
    +    $this->assertComponent('node.test_content_type.default', 'field_phone', 'telephone_link', 21);
    

    This needs to be field_telephone. And it is missing the 'label' parameter, which is probably the default, 'above'. I don't know what the weight value should be.
    $this->assertComponent('node.test_content_type.default', 'field_phone', 'basic_string', 'above', ??);

  3. +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php
    @@ -128,6 +128,7 @@ public function testWidgetSettings() {
    +    $this->assertComponent('node.test_content_type.default', 'field_phone', 'telephone_link', 21);
    

    s/field_phone/field_telephone and s/telephone_link/telephone_default/

quietone’s picture

Status: Needs work » Needs review
FileSize
6.08 KB
16.95 KB

This is one of the last two issue in the Meta for D7 migrations and I'm keen to get them committed. Therefor, worked on a reroll.

quietone’s picture

Status: Needs review » Needs work

@longwave, thanks.

I am still not sure about the map in getFieldFormatterMap. I tested on D9 and a telephone can be 'string' or 'telehone_link'

  field_tel_link:
    weight: 112
    label: above
    settings:
      title: ''
    third_party_settings: {  }
    type: telephone_link
    region: content
  field_tel_plain:
    weight: 111
    label: above
    settings:
      link_to_entity: false
    third_party_settings: {  }
    type: string
    region: content
  1. +++ b/core/modules/telephone/src/Plugin/migrate/field/d7/TelephoneField.php
    @@ -0,0 +1,36 @@
    +      'text_plain' => 'basic_string',
    

    So 'basic_string' here should be 'string', as it was originally. What confused me then was this in d7/MigrateFieldFormatterSettingsTest

        // Phone formatters are not mapped and should default to basic_string.
        $this->assertComponent('node.test_content_type.default', 'field_phone', 'basic_string', 'above', 2);

    and \Drupal\telephone\Plugin\migrate\field\d7\PhoneField maps to basic_string.

        return [
          'phone' => 'basic_string',
        ];
    

    Based on the testing on D9, field_phone should also be a 'string'. Agree? If so, that will need a followup.

  2. +++ b/core/modules/telephone/src/Plugin/migrate/field/d7/TelephoneField.php
    @@ -0,0 +1,36 @@
    +      'telephone_link' => 'basic_string',
    

    Since there really is a telephone_link type so this be 'telephone_link' => 'telephone_link',

I hope that makes sense. And the tests will need updating of course.

quietone’s picture

Status: Needs work » Needs review
FileSize
2.62 KB
19.17 KB

I'm making that changes I suggested in #43.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

#43.1 yeah that is what confused me too, there is both a basic_string and a string formatter but string is the right one here, I was misled by field_phone as well.

#43.2 yep that makes sense too.

I agree with both changes therefore this is RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 9c5da7c and pushed to 9.2.x. Thanks!

Kicked off a test against 9.1.x - will backport if it passes. - the patch doesn't apply

  • alexpott committed 9c5da7c on 9.2.x
    Issue #3005969 by tstoeckler, quietone, longwave, ayushmishra206,...

Status: Fixed » Closed (fixed)

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