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