Update target more granularly

Created on 17 April 2023, over 1 year ago
Updated 4 June 2024, 6 months ago

Problem/Motivation

Our users use feeds for both import and update a content with "update existing" flag. We have quite complex content types with lots of fields.

We use CSV as the source, but believe this feature would be useful for any source type .

To reduce the risk of introducing accidental change, our users would like to omit fields that shouldn't change from the source and only include relevant fields with the changed data.

Unfortunately, at the moment this is not possible because, if the field is present in the feed type map, it will be cleared in \Drupal\feeds\Feeds\Processor\EntityProcessorBase::map() unconditionally.

Steps to reproduce

Given:

  • feed type to import "page" node
  • mapping:
    • nid => nid
    • title => title
    • body => body:value
    • body_summary => body:summary

Import source data (using CSV only as a simplest example):

nid,title,body
1,Imported page,Page description

Update source data:

nid,title,body_summary
1,Imported page,Summary

Expected result

Node NID 1:

  • nid => 1
  • title => Imported page
  • body:value => Page description
  • body:summary => Summary

Actual result

Node NID 1:

  • nid => 1
  • title => Imported page
  • body:value => NULL
  • body:summary => Summary

Proposed resolution

Introduce a condition in \Drupal\feeds\Feeds\Processor\EntityProcessorBase::map() which would check if mapped source field is present in source item for the target.

Remaining tasks

  • Have support for the proposed approach from maintainers
  • Code a change
  • Review
  • Commit

User interface changes

None

API changes

TBC

Data model changes

None

Feature request
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

🇳🇿New Zealand RoSk0 Wellington

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024