API / Minn\Runtime / CommentQueryRunner

CommentQueryRunner final class

Minn\Runtime\CommentQueryRunner · public/minn/src/Minn/Runtime/CommentQueryRunner.php · 131 lines

WP_Comment_Query as the reference runs it (probe wp-comment-query-sql): the variables filled and handed to pre_get_comments, the meta query's SQL, comments_pre_query (which may answer), the clauses (the date query among them) handed to comments_clauses, the request, found_comments_query when a limited query counts what it found, then the ids, the count, or the comments through the_comments, threaded or flattened when asked. Results are not cached between queries (the reference keeps them in the object cache by last_changed).

Used by 1

Constants and properties

privatereadonly object $wpdb

Promoted from the constructor.

Public

new__construct(object $wpdb)#
methodrun(WP_Comment_Query $query): mixed#

Runs the query, as WP_Comment_Query::get_comments() does: a count, ids, or comments.

methodids(WP_Comment_Query $query, array $meta): array|int#

The comment IDs for the query's vars (get_comment_ids), or the count when it counts; the request is written, and the found rows read when the request counts them and found some.

$metaarray{join?: string, where?: string}
@return list<int>|int

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privaterequest(WP_Comment_Query $query, array $meta): array#

The clauses through comments_clauses, kept on the query and written as its request, and whether the request counts the rows it found.

$metaarray{join?: string, where?: string}
@return array{0: string, 1: bool}
privatecomments(array $ids, array $qv): array#

The comments for the ids in their order, each through get_comment(), their posts loaded first when asked.

$idslist<int>
$qvarray<string, mixed>
@return list<\WP_Comment>