Use cursor() fetching when deleting many posts

Refs #1319.
This commit is contained in:
Franz Liedke 2018-01-21 21:53:24 +01:00
parent 072f4f89cb
commit fa14be591c
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4
2 changed files with 2 additions and 2 deletions

View File

@ -108,7 +108,7 @@ class Discussion extends AbstractModel
// PostWasDeleted event for each post.
$posts = $discussion->posts()->allTypes();
foreach ($posts->get() as $post) {
foreach ($posts->cursor() as $post) {
$discussion->raise(new PostDeleted($post));
}

View File

@ -134,7 +134,7 @@ class User extends AbstractModel
// PostWasDeleted event for each post.
$posts = $user->posts()->allTypes();
foreach ($posts->get() as $post) {
foreach ($posts->cursor() as $post) {
$user->raise(new PostDeleted($post));
}