TermQueryRunner final class
Minn\Runtime\TermQueryRunner · public/minn/src/Minn/Runtime/TermQueryRunner.php · 299 lines
WP_Term_Query::get_terms as the reference runs it (probe wp-term-query-sql): the variables parsed and handed to pre_get_terms, get_terms_args, the WHERE pieces (taxonomies, inclusions, exclusions with excluded trees and childless terms through list_terms_exclusions, names, slugs, term taxonomy ids, likes, objects, parent, counts, search, meta), the order through get_terms_orderby, the fields through get_terms_fields, all of it through terms_clauses, terms_pre_query, and the results shaped by TermQueryTree (children, padded counts, the empty hidden, the page). A request's rows are kept for the rest of the request, as the reference keeps them in its object cache, until a term table is written; a lookup the engine can answer from what it has read (QueryAnswers) runs no SQL.
Constants and properties
| private | SHAPING = array ( 0 => 'get_terms_defaults', 1 => 'parse_term_query', 2 => 'get_terms_args', 3 => 'get_terms_orderby', 4 => 'list_terms_exclusions', 5 => 'get_terms_fields', 6 => 'terms_clauses', 7 => 'terms_pre_query', ) | The filters that shape the request: an engine answer stands only while none of them has a listener. |
| private | Minn\Objects\TermsQuery $query | |
| private | object $wpdb | |
| private | array $where | |
| private | bool $renamed | Whether saving's sanitising changed a name the query looks up (the answer then no longer fits it). |
Public
| method | run(Minn\Objects\TermsQuery $query, object $wpdb): mixed# | Runs a term query object's variables: its terms in the shape the fields ask for, a count, or what a plugin answered first.
|
Internals 14
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | answered(?Closure $answer): ?array# | The rows an engine answer gives (term ids as rows), when the query is still the one the engine wrote; null when it is not, or it has none. @return list<object>|null | ||||||
| private | kept(string $kind, Closure $read): mixed# | A request's answer read once a request: rows (each a copy, so a caller's changes stay its own) or a count.
| ||||||
| private | lists(array $args): array# | Names, slugs, term taxonomy ids and object ids as lists, as the reference holds them once plugins have had the arguments.
@return array<string, mixed> | ||||||
| private | hierarchical(array $args): bool# | Whether the results have a tree to walk (a count never does). @param array<string, mixed> $args
| ||||||
| private | settle(array $args, array $taxonomies): array# | The variables pre_get_terms left, settled: a flat taxonomy needs no tree, a parent overrides child_of, `get=all` asks for every term; then get_terms_args.
@return array<string, mixed> | ||||||
| private | inHierarchy(int $parent, array $taxonomies): bool# | Whether a parent or child_of term has children in any of the taxonomies (when none, the query is not run). @param list<string> $taxonomies
| ||||||
| private | order(array $args): array# | The ORDER BY clause and direction, term_order needing the relationships. @param array<string, mixed> $args @return array{0: string, 1: string}
| ||||||
| private | clauses(array $args, array $taxonomies): void# | The WHERE pieces, by name, in the reference's order. @param array<string, mixed> $args @param list<string> $taxonomies
| ||||||
| private | exclusions(array $args, array $taxonomies): string# | The excluded ids (an excluded term's whole tree, childless terms' parents), unless ids are included. @param array<string, mixed> $args @param list<string> $taxonomies
| ||||||
| private | names(array $args, array $taxonomies): void# | Names (as saving stores them), slugs and term taxonomy ids. @param array<string, mixed> $args @param list<string> $taxonomies
| ||||||
| private | likes(array $args): void# |
| ||||||
| private | select(array $args, array $taxonomies, string $orderby, string $order): void# | The rest of the WHERE (counts, search, meta), the fields, the joins, terms_clauses, and the request written from what it returned.
| ||||||
| private | limits(array $args): string# | A LIMIT only when no tree has to be walked first (the tree's page is cut afterwards). @param array<string, mixed> $args
| ||||||
| private | meta(): array# | The meta query's join and WHERE piece, read again in case pre_get_terms changed its variables. @return array{0: string, 1: string} @return array{0: string, 1: string} |
Nothing matches.