Problem/Motivation

The email field moved from contrib to core but core has no MigrateCckField plugin for this field type.

Proposed resolution

Add the plugin and test coverage.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webflo created an issue. See original summary.

webflo’s picture

webflo’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture

Status: Active » Postponed
windm’s picture

I applied the patch 2447727-164_0 and this one to the latest 8.1.5 and also tried with the latest dev version...
Initiating the migration, I get the following PHP fatal error:

Declaration of

Drupal\Core\Field\Plugin\migrate\cckfield\Email::ProcessCckFieldValues()

must be compatible with

Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface::ProcessCckFieldValues(Drupal\migrate\Plugin\MigrationInterface $migration, $field_name, $data)

in

/usr/local/www/drupal81/core/lib/Drupal/Core/Field/Plugin/migrate/cckfield/Email.php on line 65"

Beeing more a drupal user, than a developer or PHP expert, I´m a little bit lost, where and how to fix this...
What I find in the Email.php is:

public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {...

What I find in the MigrateCckFieldInterface.php is:

public function processCckFieldValues(MigrationInterface $migration, $field_name, $data);

When I got the PHP fatal error right, those should be "compatible"... and at least for me they look somehow compatible... ;-)
Applying only the patch 2447727-164_0, the migration works, so it´s pretty obvious, that the issue is caused by adding this email field patch.

Any ideas?

mikeryan’s picture

Category: Bug report » Task
Issue tags: +Needs reroll

The current patch here is based on 8.0.x (Migrations as entities), needs to be rerolled for 8.1.x (Migrations as plugins).

mikeryan’s picture

Issue tags: +migrate-d6-d8, +migrate-d7-d8

Is the email field the same for both D6 and D7?

mikeryan’s picture

Issue tags: +Needs tests
Anonymous’s picture

Any progress on this? We also need this to work.

mikeryan’s picture

Status: Postponed » Needs work

The *issue* does not depend on the node/user reference issue, the specific patch assumes changes in that patch. Unblocking this can proceed.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rakesh.gectcr’s picture

Status: Needs work » Needs review
FileSize
1.67 KB

I have re rolled against 8.2.x

One of the changes i have done use Drupal\migrate\Entity\MigrationInterface; TO use Drupal\migrate\Plugin\MigrationInterface;

Manuel Garcia’s picture

Issue tags: -Needs reroll
heddn’s picture

Status: Needs review » Needs work
  1. +++ b/core/lib/Drupal/Core/Field/Plugin/migrate/cckfield/Email.php
    @@ -0,0 +1,65 @@
    +    $debug = 1;
    

    Is this necessary?

  2. +++ b/core/lib/Drupal/Core/Field/Plugin/migrate/cckfield/Email.php
    @@ -0,0 +1,65 @@
    \ No newline at end of file
    

    Nit.

And still needs tests.

Manuel Garcia’s picture

Just a quick one addressing #15, although we still need tests.

Manuel Garcia’s picture

Status: Needs work » Needs review

Simple interdiff but just in case...

The last submitted patch, 2: 2665196-1.patch, failed testing.

phenaproxima’s picture

Status: Needs review » Postponed

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture

mikeryan’s picture

Status: Postponed » Needs work

cckfield patch is in!

jofitz’s picture

Status: Needs work » Needs review
FileSize
1.54 KB
1.28 KB

Converted from "cckfield" to "field".

Manuel Garcia’s picture

Status: Needs review » Needs work

#23 looks great, thanks Jo!

Setting to needs work for tests.

Sharique’s picture

Version: 8.3.x-dev » 8.4.x-dev

8.3 is release so changing version to 8.4.

quietone’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
5.34 KB
3.87 KB

Add tests and added a comma in the plugin annotation.

heddn’s picture

Status: Needs review » Needs work
+++ b/core/modules/migrate_drupal/tests/fixtures/drupal6.php
@@ -3292,7 +3292,7 @@
+  'field_test_email_email' => 'PrincessRuwenne@castle.com',

Just a nit. I think we are supposed to use @example.com for the domain name. I seem to recall reading that in some code guidance at some point. Well, it doesn't call it out specifically for email addresses, but there is https://www.drupal.org/docs/develop/standards/coding-standards#example. Which, with the spirit of the guidance would make me think that @example.com is preferred.

quietone’s picture

Status: Needs work » Needs review
FileSize
5.34 KB
1.7 KB

Changed email address as suggested.

phenaproxima’s picture

Status: Needs review » Needs work
  1. +++ b/core/lib/Drupal/Core/Field/Plugin/migrate/field/Email.php
    @@ -0,0 +1,61 @@
    +  /**
    +   * @inheritDoc
    +   */
    

    Nit: These all need to be {@inheritdoc}.

  2. +++ b/core/lib/Drupal/Core/Field/Plugin/migrate/field/Email.php
    @@ -0,0 +1,61 @@
    +      'process' => [
    +          'value' => [
    +            [
    +              'plugin' => 'skip_on_empty',
    +              'method' => 'process',
    +              'source' => 'email',
    +            ],
    +          ],
    +        ]
    

    I don't understand why we'd skip process on empty here. An empty value is a valid value for an email field, so why is skipping needed? At the very least, we should have a comment explaining this logic.

rakesh.gectcr’s picture

Comment #29

  1. Done
  2. In Content Types(nodes), there is a chance of the type Email fields are emapty (if its not a required one)
rakesh.gectcr’s picture

FileSize
1016 bytes
rakesh.gectcr’s picture

Status: Needs work » Needs review
heddn’s picture

Status: Needs review » Needs work

If it is empty, we can migrate that without the skip, no? Moving back to NW for a comment or removal.

phenaproxima’s picture

Agreed with @heddn. It is OK for us to migrate empty values in the field. Skipping is unnecessary.

rakesh.gectcr’s picture

@heddn and @phenaproxima, So lets get remove the

+              // if the email fields are not required one in content type.
+              'plugin' => 'skip_on_empty',

?

phenaproxima’s picture

A little more than that. It will probably look like this (direct mapping):

$process = [
  'plugin' => 'iterator',
  'source' => $field_name,
  'process' => [
    'value' => 'value',
  ],
];
rakesh.gectcr’s picture

Status: Needs work » Needs review
FileSize
748 bytes
5.22 KB

Ok, Lets get that done.

Status: Needs review » Needs work

The last submitted patch, 37: 2665196-37.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
FileSize
5.19 KB
2.18 KB

Just needed to rename value to email. Interdiff mysteries continue - it show changes to drupal6.php when I didn't touch the file.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Cool. I see nothing worrisome here!

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Baltimore2017

This made me learn about https://en.wikipedia.org/wiki/The_Paper_Bag_Princess which sounds way cool. Plus one for cool test data ;)

FILE: core/lib/Drupal/Core/Field/Plugin/migrate/field/Email.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 55 | ERROR | [x] The closing brace for the class must have an empty
    |       |     line before it
----------------------------------------------------------------------
rakesh.gectcr’s picture

Status: Needs work » Needs review
FileSize
281 bytes
5.22 KB

:)

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Cool. Back to RTBC.

quietone’s picture

Correction.
The princess in The Paper Bag Princess is Princess Elizabeth.

I took the name Princess Ruwenne from the Wikipedia page for The Paper Bag Princess because I was too lazy to go find my copy of the book. The name seemed wrong, but I just couldn't remember her name, so I used what was on Wikipedia. Today, I got out my copy of the book and confirmed that her name is Princess Elizabeth. I'm not interested in changing the test code (maybe I'll use the name for the d8_dump) but the Wikipedia page is now correct.

Finally, bonus points to Gábor Hojtsy for searching for Princess Ruwenne. His comment got me thinking about the story and the name, leading me to make these corrections.

  • catch committed 882537a on 8.4.x
    Issue #2665196 by rakesh.gectcr, quietone, Manuel Garcia, Jo Fitzgerald...

  • catch committed 8681ee1 on 8.3.x
    Issue #2665196 by rakesh.gectcr, quietone, Manuel Garcia, Jo Fitzgerald...
catch’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.4.x and cherry-picked to 8.3.x, thanks!

  • alexpott committed 0afbeb6 on 8.3.x
    Revert "Issue #2665196 by rakesh.gectcr, quietone, Manuel Garcia, Jo...
alexpott’s picture

Version: 8.4.x-dev » 8.3.x-dev
Status: Fixed » Patch (to be ported)

This broke 8.3.x

heddn’s picture

Status: Patch (to be ported) » Needs review
Issue tags: +Needs backport to 8.3.x, +Novice
FileSize
5.22 KB

Let's see what its complaining about on 8.3.x. Here's the same patch from #42 again. I'm optimistically tagging as novice; this is probably something fairly trivial to fix.

Status: Needs review » Needs work

The last submitted patch, 50: 2665196-42.patch, failed testing.

heddn’s picture

Issue tags: -Novice

Doesn't seem super obvious.

1) Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTest::testNode
Failed asserting that null is identical to 'default@example.com'.

/var/www/html/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php:154

1) Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeTest::testNode
Failed asserting that null is identical to 'PrincessRuwenne@example.com'.

/var/www/html/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php:85

quietone’s picture

Status: Needs work » Postponed
+++ b/core/lib/Drupal/Core/Field/Plugin/migrate/field/Email.php
@@ -0,0 +1,54 @@
+use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
...
+class Email extends FieldPluginBase {

The email plugin extends FieldPluginBase which doesn't exist in 8.3.x. The issue that creates the base class is #2683435: CCK does not exist in Drupal 7, rename Migrate's cckfield plugins to field plugins which has been committed to 8.4.x and marked as Patch (to be ported) to 8.3.x.

Seems reasonable to postpone this on #2683435: CCK does not exist in Drupal 7, rename Migrate's cckfield plugins to field plugins, which is already tagged as a blocker.

Gábor Hojtsy’s picture

Status: Postponed » Needs review
Gábor Hojtsy’s picture

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Everything seems legit here. Back to RTBC for 8.3.x.

  • Gábor Hojtsy committed b13f066 on 8.3.x authored by catch
    Issue #2665196 by rakesh.gectcr, quietone, Manuel Garcia, Jo Fitzgerald...
Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs backport to 8.3.x

Merged to 8.3.x now that it was proven it passes there with its dependency on #2683435: CCK does not exist in Drupal 7, rename Migrate's cckfield plugins to field plugins landed. Thanks all!

Status: Fixed » Closed (fixed)

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