| 1 | <?php |
||
| 24 | trait Order |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * @var array |
||
| 28 | */ |
||
| 29 | protected $orderBy = []; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Specifies an ordering for the query results |
||
| 33 | * Replaces any previously specified orderings, if any |
||
| 34 | * |
||
| 35 | * @param string $sort Sort expression |
||
| 36 | * @param string $order Sort direction (ASC or DESC) |
||
| 37 | * |
||
| 38 | * @return $this |
||
| 39 | */ |
||
| 40 | 1 | public function orderBy(string $sort, string $order = 'ASC') |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Adds an ordering to the query results |
||
| 49 | * |
||
| 50 | * @param string $sort Sort expression |
||
| 51 | * @param string $order Sort direction (ASC or DESC) |
||
| 52 | * |
||
| 53 | * @return $this |
||
| 54 | */ |
||
| 55 | 1 | public function addOrderBy(string $sort, string $order = 'ASC') |
|
| 61 | |||
| 62 | /** |
||
| 63 | * Prepare string to apply it inside SQL query |
||
| 64 | * |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | 8 | protected function prepareOrderBy() : string |
|
| 78 | } |
||
| 79 |