-
Notifications
You must be signed in to change notification settings - Fork 34
Open
silverstripe/silverstripe-framework
#9865Description
Issue
It seems like this module is unable to filter using the ORM on boolean fields unless you pass an int to the filter.
This is the error that is triggered when passing a boolean:
SilverStripe\ORM\Connect\DatabaseException: Couldn't run query:
SELECT DISTINCT "LoginSession"."ClassName", "LoginSession"."LastEdited", "LoginSession"."Created", "LoginSession"."LastAccessed", "LoginSession"."IPAddress", "LoginSession"."UserAgent", "LoginSession"."Persistent", "LoginSession"."MemberID", "LoginSession"."ID",
CASE WHEN "LoginSession"."ClassName" IS NOT NULL THEN "LoginSession"."ClassName"
ELSE E'SilverStripe\\SessionManager\\Model\\LoginSession' END AS "RecordClassName"
FROM "LoginSession"
WHERE ("LoginSession"."LastAccessed" < $1)
AND ("LoginSession"."Persistent" = $2)
ORDER BY "LoginSession"."LastAccessed" DESC
ERROR: invalid input syntax for integer: ""
Failing travis build: https://travis-ci.com/github/silverstripe/silverstripe-session-manager/jobs/482489500
Steps to Replicate
- Use PostgreSQL with SilverStripe
- Execute the following code somewhere on a DataObject with a boolean column:
MyDataObject::get()->filter([
'MyBooleanDBField' => true
]);
Expected Outcome
Booleans can be used with ORM filtering.
Version
2.3.1