resolveJoinAnchor.php
Table of Contents
Functions
- resolveJoinAnchor() : array{0: string, 1: string, 2: string}
- Resolves the **anchor** of a key-join: the `FOR` opening the joined collection and the predicate tying a joined document to the main one.
Functions
resolveJoinAnchor()
Resolves the **anchor** of a key-join: the `FOR` opening the joined collection and the predicate tying a joined document to the main one.
resolveJoinAnchor(string $key, array<string|int, mixed> $definition, string $doc, string $propertyKey) : array{0: string, 1: string, 2: string}
Several surfaces join the same way and differ only in what they do with the
joined documents — a facet tests their existence or counts them, a bound
measures one of their numeric fields — and in the declaration key naming the
main side (Facet::PROPERTY, Bound::PROPERTY, …). That last difference is
the $propertyKey parameter; everything else is shared, so a declaration
cannot mean one thing when it filters and another when it measures.
The join is doc_<key>.<AQL::KEY> == doc.<property>, with AQL::KEY the
joined side (default _key) and the property the main side (default the
entry key) — which expresses both "the document holds the foreign key" and
the reverse one-to-many "the joined documents reference the document". When
AQL::ARRAY is set the main side holds an array of keys, so the equality
becomes a membership test (IN).
Parameters
- $key : string
-
The entry key; drives the joined document reference (
doc_<key>) and the default main-side property. - $definition : array<string|int, mixed>
-
The declaration (
AQL::COLLECTION,AQL::KEY,AQL::ARRAY, and the main-side property). - $doc : string
-
The main document reference.
- $propertyKey : string
-
The declaration key naming the main-side property.
Tags
Return values
array{0: string, 1: string, 2: string} —A [ docRef , for , match ] triplet:
the joined document reference, the FOR doc_<key> IN <collection>
clause, and the join predicate to place in the FILTER.