API / Minn\Runtime / QueryAnswers

QueryAnswers final class

Minn\Runtime\QueryAnswers · public/minn/src/Minn/Runtime/QueryAnswers.php · 23 lines

Answers for queries the engine writes itself and already knows the result of, from what it has read once this request: a template part's lookup from the theme's saved templates, the theme's term from the same read. The query still runs every filter the reference runs; only the database is spared, and only while no plugin has changed the query (its variables, a clause, the request), so a lookup a plugin steers runs as written.

Constants and properties

privatestatic ?WeakMap $answers

Public

staticexpect(object $query, Closure $answer): void#

Marks a query object as one the engine can answer, before it runs.

statictake(object $query): ?Closure#

The answer a query object was given, taken so it answers once; null for any other query.