1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace ApiSkeletons\Doctrine\GraphQL\Criteria; |
6
|
|
|
|
7
|
|
|
final class Filters |
8
|
|
|
{ |
9
|
|
|
public const EQ = 'eq'; |
10
|
|
|
public const NEQ = 'neq'; |
11
|
|
|
public const LT = 'lt'; |
12
|
|
|
public const LTE = 'lte'; |
13
|
|
|
public const GT = 'gt'; |
14
|
|
|
public const GTE = 'gte'; |
15
|
|
|
public const BETWEEN = 'between'; |
16
|
|
|
public const CONTAINS = 'contains'; |
17
|
|
|
public const STARTSWITH = 'startswith'; |
18
|
|
|
public const ENDSWITH = 'endswith'; |
19
|
|
|
public const IN = 'in'; |
20
|
|
|
public const NOTIN = 'notin'; |
21
|
|
|
public const ISNULL = 'isnull'; |
22
|
|
|
public const SORT = 'sort'; |
23
|
|
|
|
24
|
|
|
/** @return string[] */ |
25
|
|
|
public static function toArray(): array |
26
|
|
|
{ |
27
|
|
|
return [ |
28
|
|
|
self::EQ, |
29
|
|
|
self::NEQ, |
30
|
|
|
self::LT, |
31
|
|
|
self::LTE, |
32
|
|
|
self::GT, |
33
|
|
|
self::GTE, |
34
|
|
|
self::BETWEEN, |
35
|
|
|
self::CONTAINS, |
36
|
|
|
self::STARTSWITH, |
37
|
|
|
self::ENDSWITH, |
38
|
|
|
self::IN, |
39
|
|
|
self::NOTIN, |
40
|
|
|
self::ISNULL, |
41
|
|
|
self::SORT, |
42
|
|
|
]; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** @return string[] */ |
46
|
|
|
public static function getDescriptions(): array |
47
|
|
|
{ |
48
|
|
|
return [ |
49
|
|
|
self::EQ => 'Equals. DateTime not supported.', |
50
|
|
|
self::NEQ => 'Not equals', |
51
|
|
|
self::LT => 'Less than', |
52
|
|
|
self::LTE => 'Less than or equals', |
53
|
|
|
self::GT => 'Greater than', |
54
|
|
|
self::GTE => 'Greater than or equals', |
55
|
|
|
self::BETWEEN => 'Is between from and to inclusive of from and to. Good substitute for DateTime Equals.', |
56
|
|
|
self::CONTAINS => 'Contains the value. Strings only.', |
57
|
|
|
self::STARTSWITH => 'Starts with the value. Strings only.', |
58
|
|
|
self::ENDSWITH => 'Ends with the value. Strings only.', |
59
|
|
|
self::IN => 'In the list of values as an array', |
60
|
|
|
self::NOTIN => 'Not in the list of values as an array', |
61
|
|
|
self::ISNULL => 'Takes a boolean. If TRUE return results where the field is null. ' |
62
|
|
|
. 'If FALSE returns results where the field is not null. ' |
63
|
|
|
. 'Acts as "isEmpty" for collection filters. A value of false will ' |
64
|
|
|
. 'be handled as though it were null.', |
65
|
|
|
self::SORT => 'Sort the result. Either "asc" or "desc".', |
66
|
|
|
]; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|