1 | <?php |
||
24 | class Sort implements SortInterface |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * Sort Ascending |
||
29 | * Alias left for BC |
||
30 | * @deprecated since version 4.0.7 |
||
31 | */ |
||
32 | const SORT_ASC = self::SortAsc; |
||
33 | |||
34 | /** |
||
35 | * Sort Descending |
||
36 | * Alias left for BC |
||
37 | * @deprecated since version 4.0.7 |
||
38 | */ |
||
39 | const SORT_DESC = self::SortDesc; |
||
40 | |||
41 | /** |
||
42 | * @Ignored |
||
43 | * @var AnnotatedInterface |
||
44 | */ |
||
45 | public $model = null; |
||
46 | |||
47 | /** |
||
48 | * |
||
49 | * @var int[] |
||
50 | */ |
||
51 | public $fields = []; |
||
52 | |||
53 | /** |
||
54 | * Condition decorator instance |
||
55 | * @var ConditionDecorator |
||
56 | */ |
||
57 | private $cd; |
||
58 | |||
59 | 11 | public function __construct($sort = [], AnnotatedInterface $model = null) |
|
67 | |||
68 | /** |
||
69 | * Add sorting field order. If field is already declared it will be pushed to the end of sort list. |
||
70 | * @param string $field |
||
71 | * @param int $order |
||
72 | */ |
||
73 | public function add($field, $order) |
||
79 | |||
80 | /** |
||
81 | * Create or replace sorting field order. If field is already declared it will **not** be pushed to the end of sort list. |
||
82 | * @param string $field |
||
83 | * @param int $order |
||
84 | */ |
||
85 | 5 | public function replace($field, $order) |
|
94 | |||
95 | /** |
||
96 | * Remove sort field |
||
97 | * @param string $field |
||
98 | */ |
||
99 | public function remove($field) |
||
107 | |||
108 | /** |
||
109 | * Returns true if sorting is applied |
||
110 | * @return bool |
||
111 | */ |
||
112 | 6 | public function isSorted() |
|
116 | |||
117 | 5 | public function getSort() |
|
131 | |||
132 | 11 | public function setModel(AnnotatedInterface $model = null) |
|
140 | |||
141 | } |
||
142 |