If I have an entity where I have overridden a particular value, that value will not hold the next time a migration is run if the field I set isn't included in the source. For example if I have an entity with a 'phone' field and I select that as an override field and assign it a value of '555-555-5555'. If I then run a migration and do not pass 'phone' as a field in the requested xml, the phone field is added as an empty destination. The migration code then sets all empty destinations to be NULL. If a field is set as a migration override it should probably be removed as an empty destination so we hold on to whatever value was originally set and not replace it with NULL.

Comments

AngryWookie created an issue. See original summary.

mikelutz’s picture

mikelutz’s picture

Status: Active » Needs work
Issue tags: +Needs tests
AngryWookie’s picture

Wrote test that will fail before this issue is fixed.

mikelutz’s picture

  1. +++ b/tests/src/Kernel/OverrideTest.php
    @@ -23,9 +23,11 @@ class OverrideTest extends MigrateOverrideTestBase {
    +    $this->config->set('entities.node.test_type.fields.missing', OverrideManagerServiceInterface::FIELD_OVERRIDEABLE);
    

    Should be 'entities.node.test_type.fields.field_test_missing'

  2. +++ b/tests/src/Kernel/OverrideTest.php
    @@ -109,5 +111,34 @@ class OverrideTest extends MigrateOverrideTestBase {
       }
    -
    

    Missing blank line before function

  3. +++ b/tests/src/Kernel/OverrideTest.php
    @@ -109,5 +111,34 @@ class OverrideTest extends MigrateOverrideTestBase {
    +  }
     }
    

    Missing blank line after function

mikelutz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.07 KB
new601 bytes

Test patch

Status: Needs review » Needs work
mikelutz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.23 KB
new5.82 KB
new4.34 KB

The last submitted patch, 8: 3040654-7.TEST_ONLY.patch, failed testing. View results

  • mikelutz authored 01e3e7b on 8.x-1.x
    Issue #3040654 by mikelutz, AngryWookie: Overridden fields set to NULL...
mikelutz’s picture

Status: Needs review » Fixed
mikelutz’s picture

Status: Fixed » Needs work

  • mikelutz committed b30450a on 8.x-1.x
    Revert "Issue #3040654 by mikelutz, AngryWookie: Overridden fields set...

  • mikelutz committed 4f40c6f on 8.x-1.x authored by AngryWookie
    Issue #3040654 by mikelutz, AngryWookie: Overridden fields set to NULL...
mikelutz’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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