Problem/Motivation
There is a bug in "add another" button inside the entity reference field when using the PostgreSQL database. The bug consists on a sql error inside the ajax requisition, as shown on the attached image, saying that ''
isn't a valid integer. This error doesn't happens when using a MySQL database.
Proposed resolution
After some bug tracking, I've found that the root of the problem is that, inside the entityreference_field_widget_form function, there is an entity_load call sending an empty string as an entity_id. The clean solution is if the id is empty inside a previous foreach lace on the code. After this simple change the problem is solved.
Comment | File | Size | Author |
---|---|---|---|
#1 | _entityreference-check_for_empty_ids_inside_entityreference_field_widget_form-2295389-1.patch | 546 bytes | tcarmona |
postgresql_error.png | 22.15 KB | tcarmona |
Comments
Comment #1
tcarmona CreditAttribution: tcarmona commentedThere is the diff patch file of the changes, as described on https://www.drupal.org/patch/submit .
Comment #2
Liam MorlandComment #3
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 5 year old patch to entityreference.module does not apply to the latest 7.x-1.x-dev and if still relevant needs a reroll.
Comment #4
rpayanmI think it was fixed it in https://www.drupal.org/project/entityreference/issues/1683964
Comment #5
joseph.olstad