timgws / QueryBuilderParser

A simple to use query builder for the jQuery QueryBuilder plugin for use with Laravel.
MIT License
159 stars 65 forks source link

Nested rules bug #66

Open ezstoritve opened 1 year ago

ezstoritve commented 1 year ago

There is a bug in QueryBuilderParser class in line 82.

If you have nested rules makeQuery function is called before isNested. As nested rules have different array structure makeQuery cannot be processed - throws an error that field does not exists.

So, you have to check if rules are nested and call makeQuery if they are not.

Original: $querybuilder = $this->makeQuery($querybuilder, $rule, $queryCondition); if ($this->isNested($rule)) { $querybuilder = $this->createNestedQuery($querybuilder, $rule, $queryCondition); }

Replace with: if ($this->isNested($rule)) { $querybuilder = $this->createNestedQuery($querybuilder, $rule, $queryCondition); } else { $querybuilder = $this->makeQuery($querybuilder, $rule, $queryCondition); }

timgws commented 1 year ago

Thanks for sending this in. I will check this out and patch if needed tomorrow.

lingtalfi commented 12 months ago

same issue here, the proposed fix seems to work just fine.

itfixit commented 7 months ago

Seems the issue is still not resolved. We cleared it in our fork for now. Is this project abandoned now?