Tucker-Eric / EloquentFilter

An Eloquent Way To Filter Laravel Models And Their Relationships

Home Page:http://tucker-eric.github.io/EloquentFilter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking change on 2.4.1 from 2.4.0

BastianErlerArbeit opened this issue · comments

#134

this Pullrequest is breaking our code because if you call whereIn with an empty Array in Laravel it returns query like

select * from some_table where 0 = 1

which gives 0 results.

But because

SomeModel::filter(['id'=>[]])

no longer calls the filter function we get a query like

select * from some_table

which returns all results.

In your filter you can override the includeFilterInput function to not filter out empty arrays:

    protected function includeFilterInput($key, $value)
    {
        return $value !== '' && $value !== null;
    }

Hey Tucker-Eric,

in my opinion this was an API-change hidden in a minor version.
And caused us a downtime.
I don't know your versioning scheme, but i would only keep this in v3, or not?

We are taking care of ourselves.
But i could imagine more people coming here sooner or later.

@PaulBehrendtVentoro Ahh, got it. Will get update out for this.

Thanks!