Ability to disable cascading for trash/restore #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request give the ability to disable cascading for trash/restore only and can still cascade the normal delete/purge.
We decided to only cascade deletion (with cascade enabled for audit log) , but never cascade trash or restore.
The reason for that is, that if you restore entity in hasMany relation, you might not want to restore 'child' entities that was intentionally trashed before you accidentally trash and restore the 'parent'.
For example, you have Users hasMany UserNotes.
User create 2 notes, User trashes one of the note.
Admin trashes User (it does trash the one not yet trashed note), then admin restore User (for some reason), the code can't restore the UserNotes to the 'previous state' like you would expect of "restore" to do, it will restore
Both
UserNotes even if one of the notes needs to be still trashed.So you want to delete UserNotes if you delete User, but you don't want to trash/restore User notes when you trash/restore User.