Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix field mapping between 2 different feed paths causes missing data #689

Closed
rob-c-baker opened this issue Apr 8, 2020 · 1 comment
Closed
Labels

Comments

@rob-c-baker
Copy link

Description

If you have a (JSON but probably applies to other formats too) feed for Matrix field mapping paths like:

[JSON Path]                ->    [Matrix Field Path]
content-text/block/body    ->    body[text][body]
images/block/image         ->    body[image][image]

There are cases where the images as above will replace/overwrite the body text previously added.

When debugging this, latching on to mostly all of the events that Feed Me raises, it looks like when the JSON is parsed it gets confused because there are separate JSON fields mapping to a single Matrix field (but different blocks).

I think the event that reveals the most is EVENT_BEFORE_PARSE_FIELD. At this point, the feedData array (in the above example) looks like:

...
"content-text/block/0/body" => "..."
...
"images/block/0/image" => "..."
...

Because the zero index after "block" is the same and the destination is the same matrix field, I think the latter overwrites the the previous when the array is "prepared" for saving, shown in the EVENT_AFTER_PARSE_FIELD - that has keys like "new1", "new2", etc. and no sign of the original "body" content.

Additional info

  • Plugin version: 4.2.2
  • Craft version: 3.4.12
@i-just
Copy link
Contributor

i-just commented Apr 17, 2023

I believe it was fixed in Feed Me 5.1.0 (see #1184 for more info), so I’m going to close it. Please feel free to get in touch again if this is a different and still unresolved issue.

@i-just i-just closed this as completed Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants