1 | <?php |
||
8 | class QueryConfigurationBuilder |
||
9 | { |
||
10 | |||
11 | /** @var mixed */ |
||
12 | protected $drawCall = 1; |
||
13 | |||
14 | /** @var mixed zero based */ |
||
15 | protected $start = 0; |
||
16 | |||
17 | /** @var mixed */ |
||
18 | protected $length = 10; |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $searchValue = null; |
||
22 | |||
23 | /** @var bool */ |
||
24 | protected $searchRegex = false; |
||
25 | |||
26 | /** @var array */ |
||
27 | protected $columSearches = []; |
||
28 | |||
29 | /** @var array */ |
||
30 | protected $columnOrders = []; |
||
31 | |||
32 | /** |
||
33 | * DTQueryConfigurationBuilder constructor, private by default, so new instances are created using the builder |
||
34 | * pattern |
||
35 | */ |
||
36 | private function __construct() |
||
39 | |||
40 | /** |
||
41 | * Will create a new QueryConfigurationBuilder internally and acts as static builder method |
||
42 | * @return QueryConfigurationBuilder |
||
43 | */ |
||
44 | public static function create() |
||
48 | |||
49 | /** |
||
50 | * Will set the drawCall parameter send by the frontend. |
||
51 | * @param mixed $drawCall The draw call parameter |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function drawCall($drawCall) |
||
62 | |||
63 | /** |
||
64 | * Will set the start parameter which indicates how many items should be skipped at the start |
||
65 | * @param mixed $start |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function start($start) |
||
76 | |||
77 | /** |
||
78 | * Will set the length parameter which indicates how many items should be returned by this request. |
||
79 | * @param mixed $length |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function length($length) |
||
90 | |||
91 | /** |
||
92 | * Will set the search value the frontend send that should be used for the global search |
||
93 | * @param string $searchValue |
||
94 | * @return $this |
||
95 | */ |
||
96 | public function searchValue($searchValue) |
||
104 | |||
105 | /** |
||
106 | * Will indicate if the global search value should be used as a regular expression |
||
107 | * @param bool $searchRegex |
||
108 | * @return $this |
||
109 | */ |
||
110 | public function searchRegex($searchRegex) |
||
118 | |||
119 | /** |
||
120 | * Will add the given search value to the given column which indicates that the frontend wants to search on the |
||
121 | * given column for the given value |
||
122 | * @param string $columnName The name of the column that will be searched |
||
123 | * @param string $searchValue The value to search for |
||
124 | * @return $this |
||
125 | */ |
||
126 | public function columnSearch($columnName, $searchValue) |
||
134 | |||
135 | /** |
||
136 | * Will set the ordering of the column to the given direction if possible |
||
137 | * @param string $columnName The column name that should be ordered |
||
138 | * @param string $orderDirection the direction that the column should be ordered by |
||
139 | * @return $this |
||
140 | */ |
||
141 | public function columnOrder($columnName, $orderDirection) |
||
150 | |||
151 | /** |
||
152 | * Will build the final QueryConfiguration that will be used later in the process pipeline |
||
153 | * @return QueryConfiguration |
||
154 | */ |
||
155 | public function build() |
||
167 | |||
168 | |||
169 | } |