-
Notifications
You must be signed in to change notification settings - Fork 904
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] Save relationship data using DB transaction #5401
Comments
Hey @YosraHamza We need more info from you to reproduce the issue you're facing so that we can look for a possible solution. See here for an example of a good issue with necessary details. Thanks! |
Hello @phpfour Here's an example of the issue:
Here, as an example. I have an order with 1-many items. Expected behavior: This can be fixed if we wrap the create function with the database transaction operation in Current:
New:
So we can keep the saved data always consistent. Thanks in advance. |
Hey @YosraHamza thanks for the suggestion. I think it makes sense, yes. 👍 Not 100% sure about all the implications (I mean, pitfall in other rdms like nosql,), so I talked with my colleges and we decided that we can push something like this, but it needs to be behind a feature flag. I am polishing the PR with the changes and I will have it ready either today or tomorrow and we can review if something is missing. Thanks again for the suggestion. 🙏 |
This is already done a few versions ago. Thanks for the suggestion @YosraHamza |
Bug report
What I did
I added a relationship field to my form, saved the form with its relation. One of the relations threw an error from the database (field cannot be null).
What I expected to happen
All the data will not be stored in the database. Main entity data and its relations.
What happened
The main entity data were saved without the relations
What I've already tried to fix it
The original function needs to use DB transactions in the store/update function
Is it a bug in the latest version of Backpack?
Yes
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:The text was updated successfully, but these errors were encountered: