Currently, the fieldOrderBy()
method in an EntityFieldQuery will exclude any Entities where the field value is empty.
This was originally discussed as a bug report in #1611438: fieldOrderBy filters out results with empty field values.
It was determined that the exclusion of entities with empty fields was by design for performance reasons.
This behavior should be documented.
Comment | File | Size | Author |
---|---|---|---|
#16 | 1662950_d7_port_16.patch | 905 bytes | bxtaylor |
#11 | 1662950_11.patch | 1.05 KB | chx |
#10 | document-that-EntityField-1662950-10.patch | 1.18 KB | mjonesdinero |
#7 | document-that-EntityField-1662950-7.patch | 740 bytes | mjonesdinero |
#2 | document_that_EntityField-1662950-2.patch | 781 bytes | mjonesdinero |
Comments
Comment #1
jhodgdonhttp://api.drupal.org/api/drupal/core!modules!entity!lib!Drupal!entity!E...
Looks like a good Novice project to add a line to the documentation with this note.
Comment #2
mjonesdinero CreditAttribution: mjonesdinero commentedAttached is the patch please feedback if there is some changes
Comment #3
jhodgdonThanks for the patch! The grammar needs a little adjustment though -- the first sentence isn't a sentence. Actually, I think it should probably start with "Note that...". I would also leave out the "this is by design" sentence. Just state what the function does.
Comment #4
bxtaylor CreditAttribution: bxtaylor commentedAgree with @jhodgdon, should read something like: "Note that Entities with empty field values will be excluded from the EntityFieldQuery results when using the fieldOrderBy() method."
Comment #5
jhodgdonI agree with #4, except that the word "entitites" does not need to be capitalized.
Comment #6
chx CreditAttribution: chx commentedYou can add the same to fieldCondition too. Thanks!
Comment #7
mjonesdinero CreditAttribution: mjonesdinero commentedupdate the what bxtaylor and jhodgdon decided
Comment #8
jhodgdonThanks!
A few things to fix:
a) The existing paragraph about "If called multiple times" should not be removed. This new text should probably be added as a separate paragraph.
b) See #6.
Comment #9
jhodgdonforgot status
Comment #10
mjonesdinero CreditAttribution: mjonesdinero commentedthanks jhodgdon
update patch now
Comment #11
chx CreditAttribution: chx commentedI moved the second to the fieldOrderBy method itself, not sure why it was on entityOrderBy? And changed the method names to simply "this method".
Comment #12
bxtaylor CreditAttribution: bxtaylor commentedPatch in #11 looks good to me. Thanks, chx!
Comment #13
mjonesdinero CreditAttribution: mjonesdinero commentedthanks for correcting chx
Comment #14
mjonesdinero CreditAttribution: mjonesdinero commentedComment #15
jhodgdonThanks! Committed to 8.x. The class is in a different file in 7.x, so this needs a port.
Comment #16
bxtaylor CreditAttribution: bxtaylor commentedHere's the patch for D7.
Comment #17
bxtaylor CreditAttribution: bxtaylor commentedComment #18
jhodgdonThis patch doesn't seem to include as much as the 8.x patch. Is that because one of the methods doesn't exist in 7.x, or because the patch is incorrect?
Comment #19
bxtaylor CreditAttribution: bxtaylor commentedI'm looking at the two patches side-by-side:
http://drupal.org/files/1662950_11.patch (chx)
http://drupal.org/files/1662950_d7_port_16.patch (mine)
and there only seems to be a one line difference.
Seem the same, otherwise.
Comment #20
chx CreditAttribution: chx commentedI copied the hunks (no headers) into two files and ran diff over them. No textual difference.
Comment #21
jhodgdonMy fault, sorry! I'll get that patch committed. Thanks!
Comment #22
jhodgdonCommitted to 7.x. Thanks again everyone!