jarektkaczyk/eloquence-base

Searchable: SQLSTATE[HY093]: Invalid parameter number

Opened this issue · 1 comments

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

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