parseFilterSegment.php
Table of Contents
Functions
- parseFilterSegment() : FilterPath|null
- Parse a single path segment from hierarchical configuration.
Functions
parseFilterSegment()
Parse a single path segment from hierarchical configuration.
parseFilterSegment(string $segment, array<string|int, mixed> $filters[, array<string|int, mixed> $edges = [] ][, array<string|int, mixed> $joins = [] ][, array<string|int, mixed> $parentPath = [] ][, ContainerInterface|null $container = null ]) : FilterPath|null
This function analyzes a filter path segment and determines its type (simple field, document, array expansion, edge, or join). It validates the segment against the configuration and, for edges and joins, resolves nested relations from target models.
Key Features:
- Validates array notation consistency (e.g.,
employee[*]must be of type EDGES/JOINS/ARRAY_EXPANSION) - Resolves nested edges/joins from target models for multi-level traversals
- Supports both explicit relation references (via AQL::RELATION) and implicit (segment key)
- Accumulates full path for better error reporting
Nested Relations Resolution: For edges, the function:
- Gets the edge model from the container
- Determines target model based on traversal direction (INBOUND → from, OUTBOUND → to)
- Extracts edges/joins from target model
- Merges with explicit nested relations from edge configuration
For joins, the function:
- Gets the join target model from the container
- Extracts edges/joins from target model
Parameters
- $segment : string
-
Current path segment (e.g., "employee[*]", "address", "workLocation")
- $filters : array<string|int, mixed>
-
Current level AQL::FILTERS configuration
- $edges : array<string|int, mixed> = []
-
Available edges configuration at current level
- $joins : array<string|int, mixed> = []
-
Available joins configuration at current level
- $parentPath : array<string|int, mixed> = []
-
Accumulated path from parent segments for error reporting
- $container : ContainerInterface|null = null
-
DI container for resolving target models and their relations
Tags
Return values
FilterPath|null —Parsed segment information with nested relations, or null if segment is not allowed