F
Filament11mo ago
Ayz

Resource Lifecycle hooks wrapped in a transaction

I would like to confirm, as implied by the title, that its all or nothing in terms of DB operations across the lifecycle hooks. For instance, in afterCreate hook of a resource, I intend to insert records in another table and update yet a 3rd. If I throw an exception at any stage, all preceding DB operations will also have no impact, including the resource. Is this a correct understanding of how filamentphp works? Or do I need to start the transaction explicitly?
2 Replies
DrByte
DrByte11mo ago
I could be wrong, but from what I know, I don't think Filament wraps its operations in "transactions". You'll need to handle that yourself.
toeknee
toeknee11mo ago
No, you would need to undo each change backwards too.
Want results from more Discord servers?
Add your server