Oihana PHP Arango

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:

  1. Look the definition up in $registry ($edges or $joins) by $key; a string value is a shortcut reference to another entry, dereferenced once.
  2. Return null when nothing resolves (the caller skips the relation).
  3. Two composable gates (logical AND): Field::REQUIRES on the FIELDS entry ($field) and AQL::REQUIRES on the definition itself. Either one denied returns null, dropping the relation from both the LET walk and — mirrored upstream by authorizeRelationFields() — the projection.
  4. Stamp Field::UNIQUE onto 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 — $edges or $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
since
1.0.0
author

Marc Alcaraz

Return values
array<string|int, mixed>|null

The prepared definition, or null when it does not resolve or is denied.

On this page

Search results