Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#50 | 2665196-42.patch | 5.22 KB | heddn |
#42 | 2665196-42.patch | 5.22 KB | rakesh.gectcr |
#42 | interdiff-2665196-39-42.txt | 281 bytes | rakesh.gectcr |
#39 | interdiff.txt | 2.18 KB | quietone |
#39 | 2665196-39.patch | 5.19 KB | quietone |
Comments
Comment #2
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #3
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedThe patch depends on #2447727: Add base class for migrating reference fields.
Comment #5
mikeryanPostponed on #2447727: Add base class for migrating reference fields.
Comment #6
windm CreditAttribution: windm commentedI 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:
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:
What I find in the MigrateCckFieldInterface.php is:
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?
Comment #7
mikeryanThe current patch here is based on 8.0.x (Migrations as entities), needs to be rerolled for 8.1.x (Migrations as plugins).
Comment #8
mikeryanIs the email field the same for both D6 and D7?
Comment #9
mikeryanComment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedAny progress on this? We also need this to work.
Comment #11
mikeryanThe *issue* does not depend on the node/user reference issue, the specific patch assumes changes in that patch. Unblocking this can proceed.
Comment #13
rakesh.gectcrI have re rolled against 8.2.x
One of the changes i have done
use Drupal\migrate\Entity\MigrationInterface;
TOuse Drupal\migrate\Plugin\MigrationInterface;
Comment #14
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedComment #15
heddnIs this necessary?
Nit.
And still needs tests.
Comment #16
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedJust a quick one addressing #15, although we still need tests.
Comment #17
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedSimple interdiff but just in case...
Comment #19
phenaproximaPostponed on #2683435: CCK does not exist in Drupal 7, rename Migrate's cckfield plugins to field plugins to avoid rerolling. And still needs tests.
Comment #21
mikeryanComment #22
mikeryancckfield patch is in!
Comment #23
jofitz CreditAttribution: jofitz at ComputerMinds commentedConverted from "cckfield" to "field".
Comment #24
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commented#23 looks great, thanks Jo!
Setting to needs work for tests.
Comment #25
Sharique CreditAttribution: Sharique as a volunteer commented8.3 is release so changing version to 8.4.
Comment #26
quietone CreditAttribution: quietone as a volunteer commentedAdd tests and added a comma in the plugin annotation.
Comment #27
heddnJust 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.
Comment #28
quietone CreditAttribution: quietone as a volunteer commentedChanged email address as suggested.
Comment #29
phenaproximaNit: These all need to be {@inheritdoc}.
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.
Comment #30
rakesh.gectcrComment #29
Email
fields are emapty (if its not a required one)Comment #31
rakesh.gectcrComment #32
rakesh.gectcrComment #33
heddnIf it is empty, we can migrate that without the skip, no? Moving back to NW for a comment or removal.
Comment #34
phenaproximaAgreed with @heddn. It is OK for us to migrate empty values in the field. Skipping is unnecessary.
Comment #35
rakesh.gectcr@heddn and @phenaproxima, So lets get remove the
?
Comment #36
phenaproximaA little more than that. It will probably look like this (direct mapping):
Comment #37
rakesh.gectcrOk, Lets get that done.
Comment #39
quietone CreditAttribution: quietone as a volunteer commentedJust needed to rename value to email. Interdiff mysteries continue - it show changes to drupal6.php when I didn't touch the file.
Comment #40
phenaproximaCool. I see nothing worrisome here!
Comment #41
Gábor HojtsyThis made me learn about https://en.wikipedia.org/wiki/The_Paper_Bag_Princess which sounds way cool. Plus one for cool test data ;)
Comment #42
rakesh.gectcr:)
Comment #43
phenaproximaCool. Back to RTBC.
Comment #44
quietone CreditAttribution: quietone as a volunteer commentedCorrection.
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.
Comment #47
catchCommitted/pushed to 8.4.x and cherry-picked to 8.3.x, thanks!
Comment #49
alexpottThis broke 8.3.x
Comment #50
heddnLet'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.
Comment #52
heddnDoesn'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
Comment #53
quietone CreditAttribution: quietone as a volunteer commentedThe 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.
Comment #54
Gábor HojtsyComment #55
Gábor HojtsyRerunning now that #2683435: CCK does not exist in Drupal 7, rename Migrate's cckfield plugins to field plugins got merged to 8.3.x.
Comment #56
phenaproximaEverything seems legit here. Back to RTBC for 8.3.x.
Comment #58
Gábor HojtsyMerged 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!