Problem/Motivation
The documentation for EntityConstraintViolationListInterface::filterByFields suggests that the result will include the given $field_names, but the opposite is actually the case. The specific part of the documentation that is wrong is:
The returned object just has violations attached to the provided fields.
Proposed resolution
Perhaps something like this would be better:
The returned object has violations attached to the provided fields removed.
Remaining tasks
Decide on wording and do!
User interface changes
None.
API changes
No change to behaviour, but fixes documentation that is the opposite. I assume this doesn't count as a BC change, as core code is using it correctly, despite the documentation actually being reversed? Either way, something should be done!
Data model changes
None.
Release notes snippet
Issue fork drupal-3098676
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3098676-filterbyfields-documentation
changes, plain diff MR !12718
Comments
Comment #5
danchadwick commentedConfirmed.
Comment #12
john.oltman commentedI ran into this recently and it cost me a debugging session. Let's get this fixed.
I used different text vs the proposed resolution, to be consistent with the verbiage for the related filterByFieldAccess method.
Comment #13
smustgrave commentedAren't we losing information but removing
Comment #14
john.oltman commentedThanks for taking a look @smustgrave. No, that text is not necessary and superfluous once the MR is applied. The new text was chosen specifically to be similar to the text for the similar
filterByFieldAccessmethod that follows. This way both "filter" methods have similar doc, as they should.Comment #15
smustgrave commentedGotcha lets see what the committers think since it's a small MR to take a look at!
Comment #16
longwaveNice find. Wrong docs are worse than no docs, so thanks for fixing this. Backported down to 10.5.x as an docs-only bug fix.
Committed and pushed 6e6d5d4ce0e to 11.x and af48404e45c to 11.3.x and 041c6bd8c01 to 10.6.x and 3cf8bdab73a to 10.5.x. Thanks!