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.
Here is a simple migration plugin for the datetime_range fields.
Comment | File | Size | Author |
---|---|---|---|
#17 | add_migration_plugin-2830296-17-complete.patch | 2.38 KB | jofitz |
#17 | add_migration_plugin-2830296-17-test_only.patch | 1.29 KB | jofitz |
#17 | interdiff_14-17.txt | 619 bytes | jofitz |
#17 | interdiff_13-17.txt | 2.89 KB | jofitz |
Comments
Comment #2
bendev CreditAttribution: bendev at WebstanZ commentedComment #4
bendev CreditAttribution: bendev at WebstanZ commentedUpdated patch
Comment #5
bendev CreditAttribution: bendev at WebstanZ commentedComment #7
bendev CreditAttribution: bendev at WebstanZ commentedsorry some difficulties to create the file. Will try this one
Comment #8
mpdonadioSending this to the migration system; they will be able to evaluate this better. I do know people have been using migrations with simple field mapping, though, and not full plugins. I'm happy with it living in the Drupal\datetime_range namespace, though, if we want to add this.
Few small comments. But this would be Needs Work for test coverage.
No need for a @file declaration for something that contains a single class.
Don't need to mention D8 here. May want to wordsmith this to match the other process plugins a little closer.
I am not 100% sure if we allow camel case in core yet (there is an issue, but I can't find it). But, if we do, then the first character should be lower case.
Can use [] syntax here; it's new code. Also, the final element should have a tailing comma.
Comment #9
bendev CreditAttribution: bendev at WebstanZ commentedupdate of the patch for the comments in #8
Comment #10
meanderix CreditAttribution: meanderix commentedIn my D7 migration, this line fails:
list($start_date, $end_date) = $value;
The
$value
variable has non-numerical indices ('value' and 'value2'), which does not work with list assignments.Comment #11
jofitz CreditAttribution: jofitz at ComputerMinds commentedSetting to Needs Review to test the patch in #9.
Comment #13
jofitz CreditAttribution: jofitz at ComputerMinds commentedAddressing comments in #8 (re-write of #9).
Comment #14
jofitz CreditAttribution: jofitz at ComputerMinds commentedAdded Unit test.
Comment #17
jofitz CreditAttribution: jofitz at ComputerMinds commentedCorrected test class name.
Comment #19
heddnI don't think this is necessary. Closing as duplicate to #2820490: FormatDate process plugin
Comment #20
windm CreditAttribution: windm commented@heddn:
When I get that right, the #2820490: FormatDate process plugin is meant for formatting non-drupal sources for importing/migrating (CSV and so on), while I expected this patch to fix problems migrating datetime_range fields from older drupal versions to d8...
So is it really a duplicate ?
My specific challenge is to migrate a d6 site with CCK datetime fields (containing from-to-ranges) to d8 - so does the #2820490: FormatDate process plugin help for this? Or should I try to use this patch (#17)?
Thank you!
Comment #21
heddnRe #20: See https://www.mtech-llc.com/blog/gerardo-hernandez/migrating-date-ranges-c... on how to migrate date range fields using CSV. The idea would be very similar when pulling from D6/D7.
The idea isn't that something doesn't need to be one for date_range, its that an additional process plugin isn't necessary.
Comment #22
Wim LeersFor automatically migrating D7
date
fields with thetodate
setting enabled: they result in data loss when usingmigrate_drupal
today. #3095237: Migrate Drupal 7 date field "todate" value fixes that.