PrepareFilter
Prepares the `filter` parameter of a controller request.
This trait expects the ControllerParam::FILTER query parameter to be a JSON encoded array/object. When it is valid, the decoded structure is returned and the raw JSON string is recorded in the parameter bag; malformed or non-array JSON is logged as a warning and the route argument value (or null) is returned instead.
Tags
Table of Contents
Methods
- prepareFilter() : array<string|int, mixed>|null
- Prepares and returns the `filter` parameter.
Methods
prepareFilter()
Prepares and returns the `filter` parameter.
protected
prepareFilter(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 incoming PSR-7 server request, or null when no request context is available.
- $args : array<string|int, mixed> = []
-
The route/controller arguments that may carry a fallback
filtervalue. - $params : array<string|int, mixed>|null = null
-
A reference to the parameter bag updated in place with the raw JSON filter string.
Return values
array<string|int, mixed>|null —The decoded filter definition, or the fallback argument value when no valid filter is provided.