Patch is created against 7.x-2.0-alpha1+3-dev
So I made this patch because I noticed that when deleting nodes which have references to other deleted nodes, the ref_field module actually 500 Fatal errors.
This is because ref_field module, assumes the entity loads correctly, then attempts to delete the references on a NULL object.
While looking in to this issue I also noticed that sub-optimal use was going on. The author was collecting nids into arrays, then going through the arrays one by one and entity_load()'ing the entities. entity_load can simply take an array of nids....and this greatly reduces the amount of DB queries (one per field, instead of one per field TIMES amount of nodes)
So my patch changes entity_load to load off multiple IDs...then off the loaded references passes them to the "add" or "remove" functions. This makes sure that only nodes which exist get passed and no "null" results.
Two birds, one stone.
It's a re-factor and no API change, so I think assuming my code is correct, this patch can simply get applies with out repercussions.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | ref_field_sync-entity-load-multiple-1928680-1.patch | 3.62 KB | j0rd |
| ref_field_sync-entity-load-multiple.patch | 3.62 KB | j0rd |
Comments
Comment #1
j0rd commentedTestbot
Comment #2
j0rd commentedTestbot needs review.
Comment #3
philipz commentedIs this somehow stuck with review status?
Comment #4
j0rd commentedI have a feeling there's no tests for this module.
I've been using this code in production for months though, and it works fine.
Comment #5
oriol_e9gWorks and thousands of sites are using DKAN rolled with this patches and works without related problems.
Comment #6
joseph.olstadsee #3038335: Offering to maintain ref_field
Comment #8
joseph.olstadcreditted j0rd