Closed misiekch closed 2 months ago
Hey @misiekch thanks for the report.
From the error you provided I think I got the "issue", and I've attempted a fix in #5639
Can you give it a test on your side to check if it solves the problem you reported ?
You can change your composer.json
to request the branch with the "fix attempt":
- "backpack/crud": "^6.7"
+ "backpack/crud": "dev-ensure-reorder-items-match-the-bidings as 6.7"
And then run a composer update to get the branch with the fix. Play with it and let me know the results. 👍
If you are still experiencing issues with the fix I attempted, can you provide me an example on how you are filtering the reorderable items etc, so that I can work with your exact example ?
Thanks again, cheers 🙏
Hey @pxpm,
I've just tested your fix and I can confirm that it works great. This is exactly what i needed.
Many thanks
Thanks @misiekch for helping testing this out.
It's now available in backpack/crud
6.7.33 👍
Let me know if you experience any other issues 🙏
Cheers
Bug report
What I did
After updating
backpack/crud
from version 6.7.18 to the latest 6.7.30, the reorder functionality stopped working in a particular case. I'm not only using reorder to sort all entries within the table, but also to sort filtered groups of entries (e.g. I have courses related to cities, which are listed and sorted for every City separately). Upon checking: v6.7.19 is the first version which breaks this functionality.What I expected to happen
I wanted to change order of items filtered by foreign key.
What happened
I am getting Illuminate\Database\QueryException - SQLSTATE[HY093]: Invalid parameter number
What I've already tried to fix it
After investigating changes in
src\app\Library\CrudPanel\Traits\Reorder.php
I have figured it out that the following line in updateTreeOrder function$itemKeys = $this->model->query()->select($primaryKey)->get()->pluck($primaryKey);
returns keys for all entries in the table instead of only filtered ones which are added later to $bindings in
array_push($bindings, ...$itemKeys->toArray());
To be clear this works perfectly when I sort all entries within table at once. Doesn't only work in case i have described above.
Is it a bug in the latest version of Backpack?
After I run
composer update backpack/crud
the bug... is it still there?Yes.
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is: