API / Minn\Runtime / TaxTerms

TaxTerms final class

Minn\Runtime\TaxTerms · public/minn/src/Minn/Runtime/TaxTerms.php · 97 lines

The terms a taxonomy query's clause names, found as the reference finds them (probe tax-terms). The clause's terms are made unique (their keys kept). Under a hierarchical taxonomy that includes children they are turned into term ids, each followed by its children (the children first, then the term, repeats kept). Then they are turned into term_taxonomy_ids. Each turn is one terms query in no order for every term at once: as many as there are terms, or all of them in a hierarchical taxonomy. No turn runs when the terms are already in the field wanted. An AND clause fails when a turn finds fewer terms than it has. The engine answers a turn from what it has just read, without the database: one by a name it knows (the theme's own term), and the second turn when the first found terms with no children; a later lookup by a slug a turn found is answered too.

Public

staticids(array $given, string $operator): ?array#

A clause's term_taxonomy_ids for its SQL (get_sql_for_clause), or null when an AND clause names a term there is not.

$givenarray<string, mixed>the clause: taxonomy, field, terms, include_children
@return list<int>|null
statictransform(mixed $clause, mixed $to): void#

A clause's terms turned into another field, as a plugin asks (transform_query): an error in the clause's place when an AND clause names a term there is not.

$clausearray<string, mixed>|object

Internals 2

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

privateturn(array $clause, string $to, ?array $known = NULL): bool#

One turn of a clause's terms into another field; false when an AND clause finds fewer terms than it has.

$clausearray<string, mixed>
$knownlist<int>|nullthe term ids the turn will find, when the engine has just read them
privatemissing(): null#

A clause naming a term there is not: the reference's message asked for, nothing found.