1 | <?php |
||
24 | trait SortAwareTrait |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var SortInterface |
||
29 | */ |
||
30 | private $sort; |
||
31 | |||
32 | /** |
||
33 | * Returns the sort object. |
||
34 | * @return Sort the sorting object. If this is false, it means the sorting is disabled. |
||
35 | */ |
||
36 | 4 | public function getSort() |
|
37 | { |
||
38 | 4 | if ($this->sort === null) |
|
39 | 4 | { |
|
40 | 4 | $this->sort = new Sort; |
|
41 | 4 | $this->sort->setModel($this->getModel()); |
|
42 | 4 | } |
|
43 | 4 | return $this->sort; |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * Set sort |
||
48 | * @param SortInterface $sort |
||
49 | * @return static |
||
50 | */ |
||
51 | public function setSort(SortInterface $sort) |
||
57 | |||
58 | abstract public function getModel(); |
||
59 | } |
||
60 |