spatie / laravel-query-builder

Easily build Eloquent queries from API requests
https://spatie.be/docs/laravel-query-builder
MIT License
4.06k stars 397 forks source link

when i use filters it give me a warning #754

Closed abdelazim94 closed 2 years ago

abdelazim94 commented 2 years ago

Since symfony/http-foundation 5.1: Retrieving a non-string value from "Symfony\Component\HttpFoundation\InputBag::get()" is deprecated, and will throw a "Symfony\Component\HttpFoundation\Exception\BadRequestException" exception in Symfony 6.0, use "Symfony\Component\HttpFoundation\InputBag::all($key)" instead.

Since symfony/http-foundation 5.1: Passing a non-scalar value as 2nd argument to "Symfony\Component\HttpFoundation\InputBag::get()" is deprecated, pass a scalar or null instead.

here is my code

$result = QueryBuilder::for($query) ->allowedFilters([ 'status', AllowedFilter::custom('fields', new CaseFieldsFilter), ]) ->defaultSort('-start_date') ->allowedSorts('start_date') ->paginate($this->pages);

shaunluedeke commented 2 years ago

I had the same error, the error comes from the Spatie\QueryBuilder\QueryBuilderRequest class for the getFilterValue() function because a null query is missing before the Str::contains