1 | <?php |
||
10 | final class SelectAggregate extends Query |
||
11 | { |
||
12 | use Traits\HasRelatedWith; |
||
13 | use Traits\HasPagination; |
||
14 | use Traits\HasJoinRelation; |
||
15 | |||
16 | private $field; |
||
17 | private const AGGREGATION_FUNCTIONS = [ |
||
18 | 'AVG', |
||
19 | 'COUNT', |
||
20 | 'MAX', |
||
21 | 'MIN', |
||
22 | 'SUM', |
||
23 | ]; |
||
24 | protected const ALLOWED_METHODS = [ |
||
25 | 'from', |
||
26 | 'join', |
||
27 | 'catJoin', |
||
28 | 'groupBy', |
||
29 | 'having', |
||
30 | 'orHaving', |
||
31 | 'orderBy', |
||
32 | 'catHaving', |
||
33 | 'where', |
||
34 | 'orWhere', |
||
35 | 'catWhere', |
||
36 | 'limit', |
||
37 | 'offset', |
||
38 | 'distinct', |
||
39 | 'forUpdate', |
||
40 | 'setFlag', |
||
41 | ]; |
||
42 | |||
43 | public function __construct(Table $table, string $function, string $field = 'id') |
||
61 | |||
62 | public function run() |
||
71 | } |
||
72 |