public function get_discussion_exporter(
        stdClass $user,
        forum_entity $forum,
        discussion_entity $discussion,
        array $groupsbyid = [],
        array $favouriteids = []
    ) : discussion_exporter {
        return new discussion_exporter($discussion, [
            'context' => $forum->get_context(),
            'forum' => $forum,
            'capabilitymanager' => $this->managerfactory->get_capability_manager($forum),
            'urlfactory' => $this->urlfactory,
            'user' => $user,
            'legacydatamapperfactory' => $this->legacydatamapperfactory,
            'latestpostid' => null,
            'groupsbyid' => $groupsbyid,
            'favouriteids' => $favouriteids
        ]);
    }