Bindings.php
1.47 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
namespace ACP\Search\Query;
class Bindings {
/**
* @var int
*/
private static $aliases = [];
/**
* @var string
*/
protected $where = '';
/**
* @var string
*/
protected $join = '';
/**
* @var string
*/
protected $group_by = '';
/**
* @var array
*/
protected $meta_query = [];
/**
* @param string $column
*
* @return string
*/
public function get_unique_alias( $column ) {
if ( ! isset( self::$aliases[ $column ] ) ) {
self::$aliases[ $column ] = 0;
}
return $column . '_ac' . self::$aliases[ $column ]++;
}
/**
* @return string
*/
public function get_where() {
return $this->where;
}
/**
* @param string $where
*
* @return $this
*/
public function where( $where ) {
$this->where = $where;
return $this;
}
/**
* @return string
*/
public function get_join() {
return $this->join;
}
/**
* @param string $join
*
* @return $this
*/
public function join( $join ) {
$this->join = $join;
return $this;
}
/**
* @return string
*/
public function get_group_by() {
return $this->group_by;
}
/**
* @param string $column
*
* @return $this
*/
public function group_by( $column ) {
$this->group_by = $column;
return $this;
}
/**
* @return array
*/
public function get_meta_query() {
return $this->meta_query;
}
/**
* @param array $args
*
* @return $this
*/
public function meta_query( array $args ) {
$this->meta_query = $args;
return $this;
}
}