Problem/Motivation

Following #2842222: D7 Plain text fields incorrectly migrated to D8 as Text (formatted) and #2893061: Create a ProcessField plugin to process the field types, we need to replace the field type static_map in the d7_field migration by dedicated Field plugins.

Proposed resolution

Modify the DateField Field plugin so it's used for D6 & D7.

Remaining tasks

Write a patch. Review.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

maxocub created an issue. See original summary.

maxocub’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new841 bytes

Here's a first patch.

phenaproxima’s picture

Assigned: Unassigned » phenaproxima

Self-assigning for review.

maxocub’s picture

+++ b/core/modules/datetime/src/Plugin/migrate/field/d7/DateField.php
@@ -0,0 +1,22 @@
+ *   type_map = {
+ *     "date" = "datetime",
+ *     "datestamp" = "datetime",
+ *     "datetime" = "datetime",
+ *   },

I created a dedicated (empty) D7 plugin because this type_map is what I found in the d7_field migration template static_map and it's different from the D6 DateField plugin type_map:

 *   type_map = {
 *     "date" = "datetime",
 *     "datestamp" = "timestamp",
 *     "datetime" = "datetime",
 *   }

Maybe we want the same thing as D6 since the difference is in the destination field type, not in the source. But then we would have to fix some tests that will fail because datetime is expected instead of timestamp.

heddn’s picture

Assigned: phenaproxima » heddn

Assigning to myself for review this week.

heddn’s picture

Assigned: heddn » Unassigned
Status: Needs review » Needs work
+++ b/core/modules/datetime/src/Plugin/migrate/field/d7/DateField.php
@@ -0,0 +1,22 @@
+use Drupal\datetime\Plugin\migrate\field\d6\DateField as D6DateField;

I'm in favor of fixing the test. And make this a general solution for d6/d7.

maxocub’s picture

Status: Needs work » Needs review
StatusFileSize
new2.69 KB
new3.52 KB

Here's a new patch using the same plugin as D6 and with the tests updated.

Should we move the DateField plugin out of the d6 namespace now that it's used for D7 too?

maxocub’s picture

Title: Create a DateField Field plugin » Modify the DateField Field plugin so it's used for D6 & D7
Issue summary: View changes

Updated IS & title.

quietone’s picture

Status: Needs review » Needs work

Should we move the DateField plugin out of the d6 namespace now that it's used for D7 too?

Yes, thanks.

maxocub’s picture

Status: Needs work » Needs review
StatusFileSize
new4.96 KB
new7.08 KB

I copied the DateField class out of the d6 namespace and deprecated the old class.
Same for the Unit test.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

I'm going to assume this comes back green. All the changes in #6 / #9 are now addressed.

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

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

catch’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!

  • catch committed 0ab00b4 on 8.5.x
    Issue #2893072 by maxocub: Modify the DateField Field plugin so it's...

  • catch committed b72db94 on 8.4.x
    Issue #2893072 by maxocub: Modify the DateField Field plugin so it's...
maxocub’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

maxocub’s picture

maxocub’s picture

maxocub’s picture