CommentQueryWhere final class
Minn\Runtime\CommentQueryWhere · public/minn/src/Minn/Runtime/CommentQueryWhere.php · 196 lines
WP_Comment_Query's WHERE pieces and the posts join, in the reference's order (probe wp-comment-query-sql): the approval statuses (with the readers whose held comments show), the post, the id lists, the author's email and url, karma, the types (notes left out unless asked for), the parent (0 for a threaded or flat query that names none), the user, the search, the post's own fields, the author lists, then the meta and date queries.
Constants and properties
| private | ID_LISTS = array ( 'comment__in' => '{c}.comment_ID IN', 'comment__not_in' => '{c}.comment_ID NOT IN', 'parent__in' => 'comment_parent IN', 'parent__not_in' => 'comment_parent NOT IN', 'post__in' => 'comment_post_ID IN', 'post__not_in' => 'comment_post_ID NOT IN', ) | |
| private | AUTHOR_LISTS = array ( 'author__in' => 'user_id IN', 'author__not_in' => 'user_id NOT IN', 'post_author__in' => 'post_author IN', 'post_author__not_in' => 'post_author NOT IN', ) | |
| private | POST_FIELDS = array ( 0 => 'post_author', 1 => 'post_name', 2 => 'post_parent', 3 => 'post_status', 4 => 'post_type', ) | |
| private | SEARCHED = array ( 0 => 'comment_author', 1 => 'comment_author_email', 2 => 'comment_author_url', 3 => 'comment_author_IP', 4 => 'comment_content', ) | |
| private | ALL = '( comment_approved = \'0\' OR comment_approved = \'1\' )' | |
| private | readonly object $wpdb | Promoted from the constructor. |
Public
| new | __construct(object $wpdb)# | ||||
| method | pieces(Minn\Objects\CommentsQuery $query, array $meta): array# | The WHERE pieces (joined with AND by the caller) and the posts join ('' when no post field is asked after).
@return array{0: list<string>, 1: string} | |||
| static | searchSql(string $search, array $columns): string# | A LIKE test over the columns (get_search_sql), as an AND clause. @param list<string> $columns
|
Internals 9
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | approved(array $qv): string# | The approval test: each status (all is approved or held, any is no test), and the held comments of the readers named by email or user id.
| |||
| private | post(array $qv): string# | The one post asked for. @param array<string, mixed> $qv
| |||
| private | types(array $qv): array# | The types in (comment stands for itself and the empty type, pings for pingbacks and trackbacks) and out; notes stay out unless asked for, and all asks for no test at all.
@return list<string> | |||
| private | parentAndUser(array $qv): array# | The parent (top level for a threaded or flat query naming none), then the user. @param array<string, mixed> $qv @return list<string>
| |||
| private | search(array $qv): array# | A LIKE test over the author's name, email, url, IP and the content. @param array<string, mixed> $qv @return list<string>
| |||
| private | posts(array $qv): array# | The post's own fields, then the comment and post author lists, and the posts join when a post column is tested.
@return array{0: list<string>, 1: string} | |||
| private | given(mixed $value): bool# | A value the query tests: anything but '', null and false. | |||
| private | listOf(mixed $value): array# | An array as given, or a comma (or space) separated string split. @return list<mixed> @return list<mixed> | |||
| private | bare(string $sql): string# | A meta or date query's SQL without its leading AND. |
Nothing matches.