From 6a21d292c5e626fbb59da2b902d307f62810e587 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 11 Nov 2017 22:40:22 +1030 Subject: [PATCH] Performance: Eager load parent tags --- extensions/tags/src/Listener/AddForumTagsRelationship.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/tags/src/Listener/AddForumTagsRelationship.php b/extensions/tags/src/Listener/AddForumTagsRelationship.php index 259d7cdc0..77bcfc029 100755 --- a/extensions/tags/src/Listener/AddForumTagsRelationship.php +++ b/extensions/tags/src/Listener/AddForumTagsRelationship.php @@ -68,7 +68,10 @@ class AddForumTagsRelationship // doesn't actually have a tags relationship, we will manually load and // assign the tags data to it using an event listener. if ($event->isController(ShowForumController::class)) { - $event->data['tags'] = Tag::whereVisibleTo($event->actor)->withStateFor($event->actor)->with('lastDiscussion')->get(); + $event->data['tags'] = Tag::whereVisibleTo($event->actor) + ->withStateFor($event->actor) + ->with(['parent', 'lastDiscussion']) + ->get(); } }