-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add table column filter support for JSON type #1747
Conversation
@@ -65,6 +65,9 @@ public static function factoryType(App $app, Field $field): self | |||
Types::DATETIME_MUTABLE => FilterModel\TypeDatetime::class, | |||
Types::DATETIME_IMMUTABLE => FilterModel\TypeDatetime::class, | |||
|
|||
Types::JSON => FilterModel\TypeString::class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These types are casted to non-string in PHP, the php values are never used in these filters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it looks like that. For example, type=json field shows as text in grid column and looks like filter works on top of it.
Probably @ibelar could check this in more details too.
Of course, filtering as string will not be the best option, but at least it will not throw exception then and at least partly work as filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also wonder if such filtering is even cross-DB compatible when the DB column type is native like JSON.
If it is, then maybe we can add FilterModel\TypeString::class
as a fallback for any unspecified type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not compatible with all DB engines, then maybe we can somehow not add filter on these columns at all (automatically)?
What I don't like there is that ugly exception we get if json column is added in Grid with filters.
e432443
to
8734db9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, waiting for a green CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! |
fix #1744
fix #1746