Model.php
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
namespace ACP\Sorting;
use AC\Column;
use ACP\Sorting\Type\DataType;
/**
* @deprecated 5.2
*/
class Model extends AbstractModel
{
/**
* @var Column
*/
protected $column;
/**
* @var string
*/
protected $orderby;
public function __construct(Column $column, DataType $data_type = null)
{
parent::__construct();
$this->column = $column;
$this->data_type = $data_type;
}
/**
* @param string $data_type_value
*/
public function set_data_type($data_type_value)
{
$this->data_type = new DataType($data_type_value);
}
/**
* Get the sorting vars
* @return array
* @since 4.0
*/
public function get_sorting_vars()
{
if ($this->orderby) {
return [
'orderby' => $this->orderby,
];
}
return [
'ids' => (new Sorter())->sort($this->get_raw_values(), $this->data_type),
];
}
/**
* @return array
*/
public function get_raw_values()
{
return [];
}
/**
* @param string $orderby
*
* @return $this
* @deprecated 5.2
*/
public function set_orderby($orderby)
{
_deprecated_function(__METHOD__, '5.2', 'ACP\Sorting\Model\OrderBy');
$this->orderby = $orderby;
return $this;
}
}