-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
When deleting a collection delete its related data thoroughly #3889
When deleting a collection delete its related data thoroughly #3889
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love if #3891 could be combined with this PR. As I mentioned there, it's such similar stuff happening right next to the other, I feel like it'd be better tested together.
You could rename the PR to something like "ensure related items are deleted when deleting a collection".
Yeah totally, I found the one issue while solving the other. The fixes are combined now into this PR. |
@jasonvarga I wonder what you mean in this comment. What is it that needs doing? |
I think I just meant once it was merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get an error when I delete the collection when using multisite.
[2021-07-14 22:48:04] local.ERROR: Call to a member function pages() on null {"userId":"3ad6235d-8556-42dd-a500-9d7cc1373bd0","exception":"[object] (Error(code: 0): Call to a member function pages() on null at /users/jason/code/statamic/three/cms/src/Entries/Entry.php:167)
[stacktrace]
#0 /Users/jason/Code/statamic/three/sandbox/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Statamic\\Entries\\Entry->Statamic\\Entries\\{closure}(Object(Statamic\\Structures\\CollectionTree))
#1 /users/jason/code/statamic/three/cms/src/Entries/Entry.php(171): tap(Object(Statamic\\Structures\\CollectionTree), Object(Closure))
#2 /Users/jason/Code/statamic/three/sandbox/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Statamic\\Entries\\Entry->Statamic\\Entries\\{closure}(Object(Statamic\\Structures\\CollectionStructure))
#3 /users/jason/code/statamic/three/cms/src/Entries/Entry.php(172): tap(Object(Statamic\\Structures\\CollectionStructure), Object(Closure))
#4 /users/jason/code/statamic/three/cms/src/Entries/Collection.php(605): Statamic\\Entries\\Entry->delete()
#5 /Users/jason/Code/statamic/three/sandbox/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(235): Statamic\\Entries\\Collection->Statamic\\Entries\\{closure}(Object(Statamic\\Entries\\Entry), 2)
#6 /users/jason/code/statamic/three/cms/src/Entries/Collection.php(606): Illuminate\\Support\\Collection->each(Object(Closure))
Thanks I'll check that. |
The last commit fixes the error. But when using multisite, the tree files are not deleted (well actually they are, but the get created again) and remain with |
Closing as this has been sitting as a draft for a while. Feel free to reopen when it's ready or there's a better solution. Thanks! |
Fixes #3848 and #3890.