I ran into a couple of issues with the code in existing_entity_id() that made feeds pull duplicates rather than it returning an existing entity id.
The condition for 'id' was $source->id, but this is there no more. There is $source->importer->id();
The test for deciding to return $entity_id was isset(). However DatabaseStatementBase::fetchField() returns FALSE so $entity_id was set.
With this fixed the prepared $query was being reused for the second test. However, the previous condition('guid', $value) was also present.
Patch to fix follows.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 2328605-14-existing_entity_id.patch | 1.51 KB | twistor |
| #12 | 2328605-12-existing_entity_id.patch | 1.52 KB | twistor |
| #10 | 2328605-10-existing_entity_id.patch | 1.41 KB | ekes |
Comments
Comment #1
ekes commentedFixes three issues above.
Comment #3
ekes commented0 fails, and that patch didn't create one of the 82 exceptions.
Comment #4
megachrizIs this still an issue now that a fix for #661606: Support unique targets in mappers has been committed? Either way, the patch provided in #1 doesn't apply anymore.
Comment #5
ekes commentedAh 4 hours is a long time in the feeds queue :-)
I'll test the new version.
Comment #6
ekes commented#661606: Support unique targets in mappers fixed the is_null/false logic error.
But the query is still reused despite having conditions added already earlier in the foreach, and it's accessing $source->id rather than $source->importer()->id.
Re-rolled.
Comment #7
ekes commentedComment #8
twistor commented$source->id is still there.
Re-using the query might not be technically correct, but it seems to be working according to the tests. At least, we should clone it rather than rebuilding it.
Can you write a test to demonstrate the problem? I cannot reproduce it.
Comment #9
twistor commentedI spoke too soon. I see the problem now with re-using the query.
Re-building the query is fine, since there should be that many unique fields anyway.
Either way, $source->id is still there.
Comment #10
ekes commented> Either way, $source->id is still there.
Quite so, not sure what happened there.
Comment #11
twistor commentedComment #12
twistor commentedHow about we move the whole thing down?
Comment #14
twistor commentedblarg.
Comment #16
twistor commentedThanks ekes!
I don't think this needed a test since it comes from *very* old code that probably didn't understand how the new db API works.