Closed (duplicate)
Project:
Entity reference
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2013 at 21:17 UTC
Updated:
10 May 2017 at 14:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
theunraveler commentedComment #2
iaha commentedI have noticed this issue as well. The function that determines referencable entities is returning an array keyed by bundle but is being treated like it is keyed by entity id.
I am uploading a patch to correctly count the number of actual entities returned and return an entity id instead of a bundle name when it validates successfully.
Patch was created against 7.x-1.x branch. I think this fits the criteria for bing a major priority because the result is data loss with no warning.
Comment #3
anrikun commented@iaha:
Your patch works, thanks.
But you should use reset() instead of array_shift().
Also you don't need to use array_keys().
Comment #4
anrikun commentedHere is a simpler version.
Comment #5
anrikun commented#4: entityreference-no_save_autocomplete-1974202-4.patch queued for re-testing.
Comment #6
anrikun commented4: entityreference-no_save_autocomplete-1974202-4.patch queued for re-testing.
Comment #7
anrikun commented4: entityreference-no_save_autocomplete-1974202-4.patch queued for re-testing.
Comment #12
anrikun commentedComment #14
damienmckenna#2375957: Autocomplete widget allows manual entry, but it fails and can corrupt data was closed as a duplicate of this one.
Comment #15
dbiscalchin commentedThe patch on #4 worked here. RTBC.
Comment #16
mgifford@dbiscalchin want to mark it RTBC?
@anrikun noted that the patches are almost the same between this and #2375957: Autocomplete widget allows manual entry, but it fails and can corrupt data (which had been marked RTBC).
Seems to mostly boil down to whether
$this->getReferencableEntities($input, '=', 6)is defined in theforeachor before it. They look like they would be functionally identical. Which better fits the style guide?Any idea why the bot is stalling on the patch in #4? Worth re-uploading it?
Comment #17
hgoto commented> Any idea why the bot is stalling on the patch in #4? Worth re-uploading it?
Though I have no idea why and how for the above question, the patch #4 worked also for me! I also think the approach of #4 is correct.
Comment #18
mgiffordJust re-uploading patch from #4 to see if we can get past the bot as suggested by @hgoto above.
Comment #19
nicrodgersPatch applies cleanly and fixes the issue for me. Code looks good and the tests are passing, to marking this as RTBC. Nice one everyone!
Comment #20
botrisTested and working fine for node and user references.
+1 for commit
Comment #21
adamps commentedThis seems to be a duplicate of #1702172: Saving allowed even when input is not valid in autocomplete results, which was raised earlier, has plenty of detailed description, and has more followers.
The patch is similar there, with more detailed error reporting. Suggest that followers here move over to the other issue.
Comment #22
hgoto commentedActually the issue #1702172 seems to be for a different problem (See the patch). But anyway this issue is a duplicate of another issue: https://www.drupal.org/node/1702172 and I think it's ok to close this one. Thank you, AdamPS.
Comment #23
WorldFallz commentedI've been struggling trying to track this down for over a day. This is definitely not a dupe of #1702171-- just reading the patch in that issue reveals they're only looking at an issue with EntityReference_SelectionHandler_Views.class.php not EntityReference_SelectionHandler_Generic.class.php.
This tiny little 5 line patch from #18 instantly fixed this bizarre behavior I thought was caused from some faulty custom code on my part. Going to do some more testing, and a reroll. I just want to re-open this in case anyone else finds themselves banging their head on the wall.
Comment #24
damienmckennaLets put it back to "needs review" then.
Comment #25
WorldFallz commentedMaybe the previous poster copied & pasted the wrong issue. Seems this exact fix is present in dev and was committed as part of #1959624: Autocomplete widgets not referencing the single entity result not 1702172.
Though it's good to reference it here as well since the subject of that issue is somewhat different.