Closed kohlerdominik closed 1 year ago
Ping @maguilar92
Please resolve the style errors: https://github.styleci.io/analyses/16NJlj
Thanks for the feedback. Fixed.
Looks good to me. Thanks for your contribution. I'm surprised I didn't run into this myself, we must have soft-deleted everything, even logs!
I found an issue, when a SoftDeleted model should delete a NotSoftDeleted model. The
CascadeQueryListener
triggers an update, and tries to update thedeleted_at
-columns, which does only exist, if the model uses SoftDeletes.My use-case is an edge-case, but still valid, I think. I have this model structure:
Logs are not SoftDeleted, as they are very short-lived anyway. They have no SoftDelete, and are lost if the Device is deleted. This works without issues.
If the Group is deleted, it does CascadeDelete the Device, which then should CascadeDelete the Logs (hard delete). But with the current code, subsequent deletes are executed as
update(['deleted_at' => '...'])
-calls, which does not work on models without SoftDelete.This fix changes the behaviour of the detection in the CascadeQueryListener for better differentiation between
delete()
andupdate()
-calls, and should resolve this issue.