1 | <?php |
||
14 | trait CRUD_helpers { |
||
15 | use |
||
16 | CRUD; |
||
17 | /** |
||
18 | * Generic search |
||
19 | * |
||
20 | * @param mixed[] $search_parameters Array in form [attribute => value];<br> |
||
21 | * Or [attribute => [value1, value2, value3]];<br> |
||
22 | * Or [attribute => [from => a, to => b]];<br> |
||
23 | * Or [attribute => [...]] in case of joined tables, where ... is any of three constructions mentioned above;<br> |
||
24 | * if `total_count => true` element is present - total number of found rows will be returned instead of rows themselves |
||
25 | * @param int $page |
||
26 | * @param int $count |
||
27 | * @param string $order_by |
||
28 | * @param bool $asc |
||
29 | * |
||
30 | * @return false|int|int[]|string[] Array of `id` or number of elements |
||
31 | */ |
||
32 | 12 | protected function search ($search_parameters = [], $page = 1, $count = 100, $order_by = 'id', $asc = false) { |
|
45 | /** |
||
46 | * @param $data_model |
||
47 | * @param $key |
||
48 | * @param $details |
||
49 | * @param string[] $where |
||
50 | * @param array $params |
||
51 | * @param string $joins |
||
52 | * @param array $join_params |
||
53 | * @param int $join_index |
||
54 | */ |
||
55 | 8 | private function search_process_parameter ($data_model, $key, $details, &$where, &$params, &$joins, &$join_params, &$join_index) { |
|
70 | /** |
||
71 | * @param string $table_alias |
||
72 | * @param bool $total_count |
||
73 | * @param string[] $where |
||
74 | * @param array $params |
||
75 | * @param string $joins |
||
76 | * @param array $join_params |
||
77 | * @param int $page |
||
78 | * @param int $count |
||
79 | * @param string $order_by |
||
80 | * @param bool $asc |
||
81 | * |
||
82 | * @return false|int|int[]|string[] |
||
83 | */ |
||
84 | 12 | private function search_do ($table_alias, $total_count, $where, $params, $joins, $join_params, $page, $count, $order_by, $asc) { |
|
115 | /** |
||
116 | * @param string $table_alias |
||
117 | * @param string $key |
||
118 | * @param array $details |
||
119 | * |
||
120 | * @return array First element is string `where` clause, second is an array of parameters |
||
1 ignored issue
–
show
|
|||
121 | */ |
||
122 | 8 | private function search_conditions ($table_alias, $key, $details) { |
|
149 | /** |
||
150 | * @param string $table_alias |
||
151 | * @param string $key |
||
152 | * @param array $details |
||
153 | * |
||
154 | * @return array First element is string `where` clause, second is an array of parameters |
||
1 ignored issue
–
show
|
|||
155 | */ |
||
156 | 2 | private function search_conditions_multilingual ($table_alias, $key, $details) { |
|
167 | /** |
||
168 | * @param string $table_alias |
||
169 | * @param string $key |
||
170 | * @param array|int|string $details |
||
171 | * @param string $joins |
||
172 | * @param array $join_params |
||
173 | * @param int $join_index |
||
174 | */ |
||
175 | 4 | private function search_conditions_join_table ($table_alias, $key, $details, &$joins, &$join_params, &$join_index) { |
|
211 | /** |
||
212 | * @param string $table_alias |
||
213 | * @param string $order_by |
||
214 | * @param string $joins |
||
215 | * @param int $join_index |
||
216 | * |
||
217 | * @return string |
||
218 | */ |
||
219 | 12 | private function search_order_by ($table_alias, $order_by, &$joins, &$join_index) { |
|
253 | } |
||
254 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.