Skip to content

fix: whereNotLike misses the not in the sql query #105

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

Merged
merged 7 commits into from
Mar 3, 2025

Conversation

mmachatschek
Copy link
Contributor

At the moment when calling whereNotLike or orWhereNotLike the query is missing the 'not' in the query. This is actually super critical.

Is there a plan to implement something to only apply the where*Like queries of this package if you use laravel/framework < 11.19.0 ? in order to use the "real" implementation of laravel itself

@mmachatschek
Copy link
Contributor Author

@tpetry i went ahead and also added the "fallback" to the available implementation of laravel if we are on laravel 11.17.0 and above

@tpetry
Copy link
Owner

tpetry commented Mar 3, 2025

Can you explain the fallback you've added? So why you've added that? Because the executed SQL queries should really not be different when a different Laravel version is used.

@mmachatschek
Copy link
Contributor Author

@tpetry laravel/framework is using the "->whereBasic" call for the Postgres grammer which is wrapping the column in a "column"::text https://github.com/laravel/framework/blob/11.x/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php#L99 thats why I had to update the test as well and use two versions of the implementation. I can update the calls of the package as well to reflect the same behaviour as laravel has.

The "fallback" i added is just using the implementation of laravel itself instead of overriding it. I don't get why the package would override the behaviour when laravel supports it out of the box since 11.17.0. I can revert the commit 4e64ea3 if you want but I'd think it would be better to use the laravel implementation instead of overriding the behaviour.

@tpetry
Copy link
Owner

tpetry commented Mar 3, 2025

I've added the whereLike implementation long before Laravel had it. So when they released it, I had to change my implementation to conform to their implementation. I seem to have missed that they do the text casting on the column.

Please remove the version check and change my implementation to be identical to Laravel's one 😉

@mmachatschek mmachatschek requested a review from tpetry March 3, 2025 15:05
@tpetry tpetry merged commit db0c873 into tpetry:master Mar 3, 2025
39 of 40 checks passed
@tpetry
Copy link
Owner

tpetry commented Mar 3, 2025

Thanks for writing the fix. And sorry for the inconvenience.

@mmachatschek mmachatschek deleted the fix/whereNotLike branch March 3, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants