esbenp / esbenp/bruno

cannot get custom filtering to work

Open
#14 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
163
Forks
70
PR merge metrics
No merged PRs in 30d

Description

in ItemRepository I have a method:

```
public function filterImages($query, $method, $clauseOperator, $value, $in)
{
if ($in) {
call_user_func([$query, $method], 'product.categories', $value);
} else {
call_user_func([$query, $method], 'product.categories', $clauseOperator, $value);
}
}
```
when i filter for key "images" and value "image.jpg" this error always comes back:

>
"Argument 1 passed to Infrastructure\Database\Eloquent\Repository::filterImages() must be an instance of Optimus\Bruno\EloquentBuilderTrait, instance of Illuminate\Database\Eloquent\Builder given",

Contributor guide

Open the contributing guide

Research direction

Start in ItemRepository at the filterImages method and reproduce filtering with key "images" and value "image.jpg". Trace why the method receives an Illuminate\\Database\\Eloquent\\Builder instead of the expected Optimus\\Bruno\\EloquentBuilderTrait type; done means the filter runs without the reported type error and returns the expected results.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.