Closed (fixed)
Project:
Date
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Aug 2012 at 20:16 UTC
Updated:
10 Oct 2013 at 16:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
jsagotsky commentedI've attached my first stab at a patch. It uses the fields method to define the subfields mentioned above. I also made a slight change to get $from and $to from the arguments, so that their subfields are usable.
Comment #2
karens commentedWe probably need to do this in a way that it won't break migrations that were already created using older methods. I can't tell if you're taking this into account.
Comment #3
mikeryanEyeballing this patch, it shouldn't affect existing migrations. The new subfield method passes the subfield internally using the same method as the former arguments method, the main thing this adds is documentation of the available subfields.
Comment #5
mikeryanGuess it does affect the old code;). So, it should be fixed to support legacy code, and there should be a new test added for the subfield approach.
Comment #6
mikeryanOK, here's some refactoring plus updated examples. This version allows the subfields to be arrays with distinct values per primary value (i.e., in a multi-value date range field each data has its own from/to). The testbot isn't going to be happy until #1832544: Class registration for Migrate 2.5 or later is committed, so that should go first, but the tests do pass in my environment with both patches present.
Comment #8
mikeryan#6: migrate_subfields-1715700-6.patch queued for re-testing.
Comment #10
drclaw commentedI think #1832544: Class registration for Migrate 2.5 or later needs to be committed before this patch will pass testing...
Comment #11
jantoine commentedCode is clean and causes the Date Migrate module to function properly with the Migrate module v7.x-2.5, following the application of the patch from #1832544: Class registration for Migrate 2.5 or later.
Comment #12
joelstein commentedAgreed. I applied the patch in #6 and had no problems migrating a date with the new subfield syntax.
Comment #13
schuffr commentedGreat news. How can we get this into date? I (and many others from what I can tell) are stuck in the water trying to import calendar events into Drupal with Migrate. It looks like the with this patch, the capability is there but when will it move to code with an even brief example of how to apply it.
Thanks all!
Comment #14
mikeryan#6: migrate_subfields-1715700-6.patch queued for re-testing.
Comment #15
mikeryanSilly me, #1832544: Class registration for Migrate 2.5 or later isn't committed yet...
Comment #16
mikeryanUpdated patch - I had trouble with timezones coming in with empty strings, !empty() works better than isset().
Comment #17
tangent commented@mikeryan, this works great for me. I simply extended (overrode) the DateMigrateFieldHandler in my custom migrate_d2d module since the patch hasn't been committed yet and that works fine.
Comment #18
nno commentedWorks great! Thank you very much!
Comment #19
rsbecker commentedTwo more additions to date.migration.inc are needed or migration fails because of undefined language variable.
and
Comment #20
rsbecker commentedOne more fix is needed to deal with date fields that are not date ranges. The date.migrate.inc file assumes there is a field_date:to subfield. If none exists the following error messages are thrown.
The class should determine whether there is a 'to' subfield and if not skip this test.
One more thing. Considering that it has been nearly 9 months since the last version and over 7 months since the last dev version, and there have been at least two patches to adapt to new versions of migrate, can you roll a new release incorporating the changes.
Comment #21
mxt@Mikeryan: I've use your #16 patch and all works well, start and end date are registered, except for this issue: dates are imported 1 day back!
For example:
source dates:
resulting imported dates:
How can this happen?
Thank you for helping me
Comment #22
rsbecker commentedIt is likely that you are having timezonebissues where the modulebis converting from your tz to utc. One fix is to append 00:00:00 to dates before importing.
Comment #23
mxtThank you rsbecker for your suggestion: I've tried it but doesn't work.
Instead, specifying precisely the timezone, everything works perfectly:
Thank you very much!
Comment #24
mikeryanThis patch has been incorporated into the consolidated patch at #2034231: [META] Integrated patch for migration changes.
Comment #25
cafuego commented