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

Introduce class ipl\Orm\Behavior\NonTextMatch #71

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nilmerg
Copy link
Member

@nilmerg nilmerg commented Aug 4, 2022

It's purpose is to automatically cast non-text values
to text if the used filter is a LIKE.

Though, I don't like this. But it's the only solution
right now. It depends highly on the maintained column
type. While this isn't that bad, since I believe there
are more text columns than other types (so maintaining them
isn't that difficult), but currentlyl there's no default
type. So if the type is not maintained, it currently casts
everything to text, even if not necessary. But is it a good
idea to have the type default to text?

This needs to be addressed.

Also, is there an alternative implementation? Another bad
thing is that each model has to provide it explicitly. This
should be a default behavior somehow if you ask me. If you
have several models seeing this everywhere makes you wonder:

$behaviors->add(new NonTextMatch());

requires #70

It's purpose is to automatically cast non-text values
to text if the used filter is a `LIKE`.

Though, I don't *like* this. But it's the only solution
right now. It depends highly on the maintained column
type. While this isn't that bad, since *I* believe there
are more text columns than other types (so maintaining them
isn't that difficult), but currentlyl there's no default
type. So if the type is not maintained, it currently casts
everything to text, even if not necessary. But is it a good
idea to have the type default to text?

This needs to be addressed.

Also, is there an alternative implementation? Another bad
thing is that each model has to provide it explicitly. This
should be a default behavior somehow if you ask me. If you
have several models seeing this everywhere makes you wonder:

```
$behaviors->add(new NonTextMatch());
```
@nilmerg nilmerg self-assigned this Aug 4, 2022
@cla-bot cla-bot bot added the cla/signed label Aug 4, 2022
@nilmerg
Copy link
Member Author

nilmerg commented Aug 4, 2022

Oh, and it's here because there's the Binary behavior already and I see similarities. 😉

@nilmerg
Copy link
Member Author

nilmerg commented Aug 4, 2022

And another problem that comes to my mind right now: What about the filter optimizations? We add ::text to the column name here, which makes it differ from the previous definition. The optimizations however depend on the column name and... yeah, the result are separate subqueries 😐

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

Successfully merging this pull request may close these issues.

1 participant