prepareRelationDefinition.php
Table of Contents
Functions
- prepareRelationDefinition() : array<string|int, mixed>|null
- Resolves, permission-gates and stamps a relation definition (edge or join) before it is handed to a relation builder — the common preamble shared by the `Filter::EDGE(S)` and `Filter::JOIN(S)` branches of {@see buildVariables()}.
Functions
prepareRelationDefinition()
Resolves, permission-gates and stamps a relation definition (edge or join) before it is handed to a relation builder — the common preamble shared by the `Filter::EDGE(S)` and `Filter::JOIN(S)` branches of {@see buildVariables()}.
prepareRelationDefinition(array<string|int, mixed>|null $registry, int|string $key, array<string|int, mixed> $field, mixed $unique, array<string|int, mixed> $init) : array<string|int, mixed>|null
Steps:
- Look the definition up in
$registry($edgesor$joins) by$key; a string value is a shortcut reference to another entry, dereferenced once. - Return
nullwhen nothing resolves (the caller skips the relation). - Two composable gates (logical AND):
Field::REQUIRESon the FIELDS entry ($field) andAQL::REQUIRESon the definition itself. Either one denied returnsnull, dropping the relation from both theLETwalk and — mirrored upstream by authorizeRelationFields() — the projection. - Stamp
Field::UNIQUEonto the definition (the caller-provided AQL variable name override).
A Filter::EDGES_COUNT is gated the same way: its count LET is dropped only
when the entry (or the shared definition) declares a requirement — otherwise the
cardinality stays visible, as knowing it is rarely a leak.
Parameters
- $registry : array<string|int, mixed>|null
-
The relation registry —
$edgesor$joins. - $key : int|string
-
The field key naming the relation.
- $field : array<string|int, mixed>
-
The FIELDS entry (read for
Field::REQUIRES/ gating). - $unique : mixed
-
The AQL variable name override stamped as
Field::UNIQUE. - $init : array<string|int, mixed>
-
The request-level init array (reads
Arango::AUTHORIZER).
Tags
Return values
array<string|int, mixed>|null —The prepared definition, or null when it does not resolve or is denied.