Oihana PHP Arango

unreadableFilter.php

Table of Contents

Functions

unreadableFilter()  : RequestValidationException
Builds the refusal answered to a request whose filter has a shape no filter reads : not a segment `{"key":…}`, not a group `["and"|"or"|"not", …]`.

Functions

unreadableFilter()

Builds the refusal answered to a request whose filter has a shape no filter reads : not a segment `{"key":…}`, not a group `["and"|"or"|"not", …]`.

unreadableFilter(mixed $filter) : RequestValidationException

Such a filter used to be dropped : no clause, no error, and the whole collection came back in 200 — a Mongo-style {"age":{"$gte":30}}, a mistyped {"agee":1}, a filter left as a JSON string, the {"logic":…,"conditions":[…]} form the documentation once taught. Inside an and, the child vanished and loosened the group. The refusal names what arrived — the type of a scalar, the keys of an object — and the two shapes that would have been read.

Parameters
$filter : mixed

The filter, or the member of a group, as the request sent it.

Tags
example
throw unreadableFilter( '{"key":"age"}' ) ;
// A filter is a segment {"key":…} or a group ["and"|"or"|"not", …] : string given.

throw unreadableFilter( [ 'agee' => 1 ] ) ;
// The filter {"agee"} speaks no filter grammar : name the field with "key" — {"key":…,"op":…,"val":…} — or write a group as a list — ["and"|"or"|"not", …].

throw unreadableFilter( [] ) ;
// A filter group holds no condition.
author

Marc Alcaraz (eKameleon)

version
1.0.0
Return values
RequestValidationException —

The 400 refusal, ready to be thrown.

On this page

Search results