-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] In case of disabled lazy load eager load relation query on update #5520
Comments
Hey @gaborfarkas0211 thanks for the report. It's an issue that we are aware, unfortunately it's a BC to introduce and we missed the opportunity to do it in v6 sadly :( Please fix it on your side for the moment, an easy way would be to create a copy of the update operation trait to your app and call it Let me know if that helps. Cheers |
Bug report
What I did
Lazy load is disabled in my project. I have a repeatable field using a hasMany relation on create and update. In the setup, I eager load the required relations for operations. I created an entry with the hasMany relation using the repeatable field. When I tried to update, the edit action gave me an error: Attempted to lazy load [relation] on model [model] but lazy loading is disabled.
What I expected to happen
The relations are loaded and the repeatable field is filled on update.
What happened
I have got the $entry property on CrudPanel without relations. The UpdateOperation edit's action checks the access to the given model. That means the CrudPanel's Access trait will set the $entry property using 'getModelWithCrudPanelQuery' query. After that the $entry property is set and the custom query will not used.
What I've already tried to fix it
There is no way for me to fix it unless I override the UpdateOperation's edit action in my project.
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:PHP VERSION:
8.3.4
LARAVEL VERSION:
11.7.0.0
BACKPACK PACKAGE VERSIONS:
backpack/crud: 6.7.12
backpack/pro: 2.2.0
The text was updated successfully, but these errors were encountered: