Oihana PHP Arango

unknownFilterKey.php

Table of Contents

Functions

unknownFilterKey()  : RequestValidationException
Builds the refusal answered to a request whose filter names a key the model does not declare at that level.

Functions

unknownFilterKey()

Builds the refusal answered to a request whose filter names a key the model does not declare at that level.

unknownFilterKey(string $key[, array<string|int, string> $path = [] ]) : RequestValidationException

A key absent from AQL::FILTERS used to be dropped : the predicate vanished, the query left without it, and the whole collection came back in 200. A caller that trusted its limit then labelled its screen from whatever arrived first, with no error, no empty page and nothing in its own log to notice. The refusal names the key and, when the key is nested, the path it was looked up under — what the caller has to correct, and nothing else : the keys the model does accept are documentation, not an error message.

The same sentence is answered at the root of a filter and at every depth of a hierarchical one, so a mistyped key is told apart from nothing but its position.

Parameters
$key : string

The key as the request spelled it, without its [*] marker.

$path : array<string|int, string> = []

The parent segments the key was looked up under, empty at the root.

Tags
example
throw unknownFilterKey( 'pays' ) ;             // The filter key "pays" is not filterable.
throw unknownFilterKey( 'pays' , [ 'address' ] ) ; // The filter key "pays" is not filterable at "address".
author

Marc Alcaraz (ekameleon)

Return values
RequestValidationException —

The 400 refusal, ready to be thrown.

On this page

Search results