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

Searchable: SQLSTATE[HY093]: Invalid parameter number #28

Open
ghost opened this issue May 25, 2020 · 1 comment
Open

Searchable: SQLSTATE[HY093]: Invalid parameter number #28

ghost opened this issue May 25, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented May 25, 2020

I'm not sure under which conditions this happens, this commit from Laravel 7.8.0 update breaks some search queries:
laravel/framework@70d7ba1

@joegrace
Copy link

joegrace commented Mar 26, 2021

I'm not sure under which conditions this happens, this commit from Laravel 7.8.0 update breaks some search queries:
laravel/framework@70d7ba1

@studmon After I spent the good portion of today and yesterday messing around with this, I found it was related to this core laravel commit: laravel/framework@70d7ba1

For some reason the bindings get reset (as you can see from that commit) when you call select() :-( So all of the work that eloquence did putting all the parameters together with the placeholders in the query all gets blown away and reset.

If you are using select() in your eloquent query, I would recommend calling the select() before search() and if you can, I would call select before any other eloquent methods.

-Joe

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

No branches or pull requests

1 participant