\Dewdrop\FilterNullableDbBoolean

This filter is intended to assist with DB boolean fields that are allowed to be nullable, essentially making them a tri-state field: null, false, or true.

In the case of a checkbox input, obviously, you cannot really differentiate between null and false, but you can when using something like a yes/no select/dropdown.

Summary

Methods
Properties
Constants
filter()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

filter()

filter(mixed  $value) : integer|null

For empty strings (think HTTP requests, where everything is a string), or actual nulls, we return null. If not, we return the value cast to an int, which is friendlier than dragging around the actual boolean because those don't play nice with the DBs.

Parameters

mixed $value

Returns

integer|null