Skip to content
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

Merged
merged 5 commits into from
Aug 30, 2022

Conversation

DarkSide666
Copy link
Member

@DarkSide666 DarkSide666 commented Mar 4, 2022

fix #1744
fix #1746

@@ -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,
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@mvorisek mvorisek Mar 5, 2022

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

Copy link
Member Author

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.

@mvorisek mvorisek removed their request for review April 22, 2022 16:45
@mvorisek mvorisek changed the title Feature/fix table filters Add table column filter support for JSON type Aug 28, 2022
Copy link
Member

@mvorisek mvorisek left a 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

Copy link
Member

@mvorisek mvorisek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

for some reasons, Behat /w Coverage does not pass, it seems unrelated, but better to fix it first

@mvorisek mvorisek merged commit 1aab74b into develop Aug 30, 2022
@mvorisek mvorisek deleted the feature/fix-table-filters branch August 30, 2022 10:57
@mvorisek
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants