You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To sum up what's being discussed in the Silverstripe User's Slack at the moment:
it appears the SS is doing some "magic" to set an empty string (in this case) as null to represent an "empty" value. There's some debate as to whether this is desired, but it is currently the case
the problem that is occurring at the moment is a disconnect between the filtering behaviour and the storage behaviour - if I can set '' and get null, I should be able to filter for '' and return null results. It is this inconsistency that is the core of the issue
so any proposed changes should either:
a. lean into the magic, and have the filter understand it
b. lean away from the magic, and have things stored as they are put in
Proposed solution: If you filter for NULL or EMPTY STRING it should yield the same result, unless you set some "strict" setting, in which case it would go for NULL or EMPTY STRING only.
What would the strict setting look like? Would you set it globally or per datalist or per filter?
If we're leaning into the magic, it probably should apply only for the DBField implementations we know use that magic. I don't know off the top of my head if the filter uses any introspection about the fields it's filtering against though.
GuySartorelli
changed the title
NULL vs EMPTY string causes confusion
Filtering against NULL vs empty string causes confusion
Sep 11, 2024
Module version(s) affected
5.x-dev
Description
See original ticket here: #11363 (comment)
Proposed solution: If you filter for NULL or EMPTY STRING it should yield the same result, unless you set some "strict" setting, in which case it would go for NULL or EMPTY STRING only.
How to reproduce
This results in xyz=0
where xyz is the number of records and 0 is always zero!
Possible Solution
see: #11363
Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)The text was updated successfully, but these errors were encountered: