Problem/Motivation

Migrate needs to support D6 user reference fields and migrate them (plus their settings, values, all that jazz) to D8 core entity reference fields.

Proposed resolution

Add a new field plugin that handles D6 user reference fields.

Remaining tasks

Write the patch, tests, docs.

User interface changes

None.

API changes

None.

Comments

claudiu.cristea’s picture

Assigned: Unassigned » claudiu.cristea

Take this too as I started with node reference.

claudiu.cristea’s picture

Status: Active » Closed (duplicate)
phenaproxima’s picture

Status: Closed (duplicate) » Postponed
Issue tags: +migrate-d6-d8

In the name of sanity and scope control, we're splitting #2447727: Add base class for migrating reference fields back out into smaller issues. This is now resurrected and postponed on that.

phenaproxima’s picture

Version: 8.0.x-dev » 8.3.x-dev
Assigned: claudiu.cristea » Unassigned
Issue summary: View changes

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

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now 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.

phenaproxima’s picture

Title: Add migrate support for Drupal 6 user reference » Migrate D6 node reference fields to D8 entity reference field storage config entities
Status: Postponed » Needs review
StatusFileSize
new18.58 KB

Users must migrate
For completeness of Migrate
Gentlefolk...BEHOLD!

heddn’s picture

Title: Migrate D6 node reference fields to D8 entity reference field storage config entities » Migrate D6 user reference fields to D8 entity reference field storage config entities

Seems a re-title would be in order.

heddn’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal6.php
    @@ -603,6 +603,21 @@
    +$connection->insert('batch')
    

    What's this from?

  2. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal6.php
    @@ -42992,7 +43162,7 @@
    +  'changed' => '1494966544',
    
    @@ -43577,7 +43747,7 @@
    -  'timestamp' => '1493066711',
    +  'timestamp' => '1494966544',
    
    @@ -45087,10 +45257,10 @@
    +  'status' => '1',
    ...
    +  'schema_version' => '6002',
    
    @@ -46394,8 +46564,8 @@
    +  'access' => '1494966478',
    +  'login' => '1494966280',
    
    @@ -47476,7 +47646,7 @@
    +  'value' => 'a:16:{i:0;s:14:"misc/jquery.js";i:1;s:14:"misc/drupal.js";i:2;s:19:"misc/tableheader.js";s:10:"refresh:fr";s:7:"waiting";s:10:"refresh:zu";s:7:"waiting";i:3;s:17:"misc/tabledrag.js";i:4;s:32:"sites/all/modules/cck/content.js";i:5;s:16:"misc/textarea.js";i:6;s:16:"misc/collapse.js";i:7;s:12:"misc/form.js";i:8;s:19:"misc/tableselect.js";i:9;s:20:"modules/user/user.js";i:10;s:20:"misc/autocomplete.js";i:11;s:19:"misc/jquery.form.js";i:12;s:12:"misc/ahah.js";i:13;s:14:"misc/teaser.js";}',
    

    Seems like a few stray lines here.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new20.05 KB
new1.13 KB

Well, when I manipulate the fixture, I install Drupal 6 and do what I would normally do to make the necessary modifications (i.e., standard procedure for manipulating the fixture). Whatever changes that causes, I just roll into the patch -- I try to let them come through as untouched as possible. So I'm not sure those lines are any cause for concern.

This should fix the broken tests.

heddn’s picture

Assigned: Unassigned » heddn

Assigning to myself to review this week.

heddn’s picture

Assigned: heddn » Unassigned
Status: Needs review » Reviewed & tested by the community

All my concerns are addressed. RTBC.

catch’s picture

Status: Reviewed & tested by the community » Needs review

+++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldSettings.php
+++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldSettings.php
@@ -21,22 +21,24 @@ class FieldSettings extends ProcessPluginBase {

@@ -21,22 +21,24 @@ class FieldSettings extends ProcessPluginBase {
    * Get the field default/mapped settings.
    */
   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
-    list($field_type, $global_settings) = $value;
-    return $this->getSettings($field_type, $global_settings);
+    list($field_type, $global_settings, $original_field_type) = $value;
+    return $this->getSettings($field_type, $global_settings, $original_field_type);
   }
 
   /**
    * Merge the default D8 and specified D6 settings.
    *
    * @param string $field_type
-   *   The field type.
+   *   The destination field type.
    * @param array $global_settings
    *   The field settings.
+   * @param string $original_field_type
+   *   The original field type before migration.
    *
    * @return array
    *   A valid array of settings.
    */
-  public function getSettings($field_type, $global_settings) {
+  public function getSettings($field_type, $global_settings, $original_field_type) {
     $max_length = isset($global_settings['max_length']) ? $global_settings['max_length'] : '';
     $max_length = empty($max_length) ? 255 : $max_length;
     $allowed_values = [];

Do we need to worry about the additional $original_field_type argument? Can it default to NULL - looks like it's actually optional.

phenaproxima’s picture

StatusFileSize
new20.17 KB
new1.44 KB

Nice find. This oughta do the trick!

heddn’s picture

Status: Needs review » Reviewed & tested by the community

This looks good. I wondered what happened with list() if there weren't enough values passed to it and if the count stuff was necessary. It is, otherwise you result in Notice: Undefined index: 2.

  • catch committed a153149 on 8.4.x
    Issue #2447729 by phenaproxima, heddn: Migrate D6 user reference fields...

  • catch committed e3a5bc0 on 8.3.x
    Issue #2447729 by phenaproxima, heddn: Migrate D6 user reference fields...
catch’s picture

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

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

Status: Fixed » Closed (fixed)

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