PrepareGroupTrait
Prepares the high-level grouping spec ({@see Arango::GROUP}) from the HTTP request, the controller counterpart of {@see \oihana\arango\models\traits\aql\GroupTrait}.
Two query parameters feed it:
?group={...}— the full JSON spec using the short GroupParam keys (by/agg/count/sort/alt), mapped onto the Group vocabulary.?groupBy=field[,field]— the CSV shortcut forby, which also implies a per-group count (the common faceted-list intent) unless the JSON spec already defines aggregates or a count.
A predefined spec under $args[Arango::GROUP] is used as the base and merged.
Tags
Table of Contents
Methods
- prepareGroup() : array<string|int, mixed>|null
- Resolves the {@see Arango::GROUP} spec for a list query.
- mapGroupParams() : array<string|int, mixed>
- Maps the short HTTP {@see GroupParam} keys onto the {@see Group} vocabulary.
Methods
prepareGroup()
Resolves the {@see Arango::GROUP} spec for a list query.
protected
prepareGroup(ServerRequestInterface|null $request[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null &$params = null ]) : array<string|int, mixed>|null
Parameters
- $request : ServerRequestInterface|null
-
The HTTP request.
- $args : array<string|int, mixed> = []
-
Predefined options (
$args[Arango::GROUP]as base). - $params : array<string|int, mixed>|null = null
-
Echoed query params, populated by reference.
Return values
array<string|int, mixed>|null —The Group spec, or null when no grouping is requested.
mapGroupParams()
Maps the short HTTP {@see GroupParam} keys onto the {@see Group} vocabulary.
private
mapGroupParams(array<string|int, mixed> $decoded) : array<string|int, mixed>
Parameters
- $decoded : array<string|int, mixed>
-
The decoded
?group=JSON object.
Return values
array<string|int, mixed> —The translated spec keyed by Group::*.