Closed (fixed)
Project:
Feeds
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Mar 2013 at 14:13 UTC
Updated:
2 Aug 2018 at 10:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mikran commentedThis patch changes the hash in a way that it's calculated from mapped data only.
Comment #3
mikran commentedOhh fake columns need additional isset() check there.
Comment #4
mikran commentedone more
Comment #6
mikran commentedLast patch for the day. Improved fake mappings and lying comments removed.
Comment #7
mikran commentedComment #8
twistor commentedThis should just use array_key_intersect().
We can't special-case for the CSV parser here. Oh how I hate it for its lowercase shenanigans. I guess we'd have to add a method on parsers, something like getMappingSourceList() or a better name.
The old way of appending serialize($this->config['mappings']) should stay as well.
Comment #9
mikran commentedMy friday-mind can't come up with a better name either but proposed changes are here
Comment #10
rudiedirkx commentedThis is the full source hash, or hash per item?
Comment #11
mikran commentedre #10: hash per item
Comment #11.0
mikran commentedtypo
Comment #14
joelpittet@mikran What about making this configurable/hookable so that you can filter out the ones you don't want to include and then you can use that $mappings in the API docs as an example if you want to only used mapped ones?
That way you won't break BC. I currently use the other fields as extra insurance that a field has updated.
Comment #15
mikran commentedYes it is a BC break but can you explain the use case a bit more? Feeds is still an alpha and I'm facing this issue in every project so I'd imagine it's quite common.
Comment #17
megachrizLooks good to me. In the attached patch, I have moved the test to a separate test method, so that this feature is more visible in the tests. This is handy when the time comes to port all recently added features of Feeds to the D8 version.
I did notice that when only the order of the source columns changed, items were updated regardless of this change. For example, in case of a CSV, when the colums were first in this order: "guid,title,body" and then a column is moved so that the order becomes "title,body,guid" all items are updated even when no data changed. I think though that such a case is very rare, so I don't find that a good reason to refuse this patch.
@joelpittet
A workaround for your use case (ensure that an item is updated) is to map a source to a dummy target.
Comment #18
megachrizCommitted #17.
Comment #21
megachrizCreated a follow-up issue for the port to D8: #2990155: Only update when mapped fields are updated