Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Note this is (arguably) a bug report, but I didn't want to fight that fight, so tagging as 'task'.
This was originally found in #2177799: Allow IntegerItem's to be unsigned.
Problem/Motivation
setConstraints() overrides the entire list of constraints so it may remove previously set constraints. It should only be used in tests and when the entire list of constraints has previously been fetched with getConstraints()
Proposed resolution
- Replace usages of setConstraints() with addConstraint() where appropriate.
- Add a warning to the method doc.
Remaining tasks
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2235125-3-set-vs-add-constraint.patch | 3.11 KB | tstoeckler |
Comments
Comment #1
tstoecklerHere we go.
Comment #3
tstoecklerOops, too much copy and paste.
Comment #4
sunThanks!
Comment #5
webchickCommitted and pushed to 8.x. Thanks!