public function get_reply_count_for_post_id_in_discussion_id(
            stdClass $user, int $postid, int $discussionid, bool $canseeprivatereplies) : int {
        [
            'where' => $privatewhere,
            'params' => $privateparams,
        ] = $this->get_private_reply_sql($user, $canseeprivatereplies);

        $alias = $this->get_table_alias();
        $table = self::TABLE;

        $sql = "SELECT {$alias}.id, {$alias}.parent
                  FROM {{$table}} {$alias}
                 WHERE p.discussion = :discussionid {$privatewhere}";

        $postparents = $this->get_db()->get_records_sql_menu($sql, array_merge([
                'discussionid' => $discussionid,
            ], $privateparams));

        return $this->count_children_from_parent_recursively($postparents, $postid);
    }
public function get_reply_count_for_post_id_in_discussion_id(
            stdClass $user, int $postid, int $discussionid, bool $canseeprivatereplies) : int {
        [
            'where' => $privatewhere,
            'params' => $privateparams,
        ] = $this->get_private_reply_sql($user, $canseeprivatereplies);

        $alias = $this->get_table_alias();
        $table = self::TABLE;

        $sql = "SELECT {$alias}.id, {$alias}.parent
                  FROM {{$table}} {$alias}
                 WHERE p.discussion = :discussionid {$privatewhere}";

        $postparents = $this->get_db()->get_records_sql_menu($sql, array_merge([
                'discussionid' => $discussionid,
            ], $privateparams));

        return $this->count_children_from_parent_recursively($postparents, $postid);
    }
public function get_reply_count_for_post_id_in_discussion_id ( stdClass $ user , int $ postid , int $ discussionid , bool $ canseeprivatereplies ) : int { [ 'where' => $ privatewhere , 'params' => $ privateparams , ] = $ this -> get_private_reply_sql ( $ user , $ canseeprivatereplies ) ; $ alias = $ this -> get_table_alias ( ) ; $ table = self :: TABLE ; $ sql = "SELECT {$alias}.id, {$alias}.parent
                  FROM {{$table}} {$alias}
                 WHERE p.discussion = :discussionid {$privatewhere}" ; $ postparents = $ this -> get_db ( ) -> get_records_sql_menu ( $ sql , array_merge ( [ 'discussionid' => $ discussionid , ] , $ privateparams ) ) ; return $ this -> count_children_from_parent_recursively ( $ postparents , $ postid ) ; }
Get a mapping of replies to the specified discussions.

@param   stdClass    $user The user to check the unread count for
@param   int         $postid The post to collect replies to
@param   int         $discussionid The list of discussions to fetch counts for
@param   bool        $canseeprivatereplies Whether this user can see all private replies or not
@return  int         The number of replies for each discussion returned in an associative array
Get a mapping of replies to the specified discussions .