1
0
mirror of https://github.com/flarum/core.git synced 2025-10-19 02:36:08 +02:00

Fix entity deletion

Foreign keys take care of most of this for us!
This commit is contained in:
Toby Zerner
2018-07-21 17:18:40 +09:30
parent 22fadb7f9c
commit 4f259425b0
4 changed files with 2 additions and 35 deletions

View File

@@ -126,22 +126,6 @@ class User extends AbstractModel
static::deleted(function (User $user) {
$user->raise(new Deleted($user));
// Delete all of the posts by the user. Before we delete them
// in a big batch query, we will loop through them and raise a
// PostWasDeleted event for each post.
$posts = $user->posts()->allTypes();
foreach ($posts->cursor() as $post) {
$user->raise(new PostDeleted($post));
}
$posts->delete();
$user->read()->detach();
$user->groups()->detach();
$user->accessTokens()->delete();
$user->notifications()->delete();
});
static::$dispatcher->fire(