Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
union.php
1
<?php
9
namespace
Bitrix\Main\ORM\Query
;
10
use
Bitrix\Main\ArgumentException
;
11
use
Bitrix\Main\DB\Connection
;
12
19
class
Union
20
{
22
protected
$queries
;
23
25
protected
$order
;
26
28
protected
$limit
;
29
31
protected
$offset
;
32
34
protected
$connection
;
35
36
public
function
__construct
(
Connection
$connection
)
37
{
38
$this->connection =
$connection
;
39
}
40
46
public
function
addQuery
(
UnionCondition
$query)
47
{
48
$this->queries[] = $query;
49
return
$this;
50
}
51
55
public
function
getQueries
()
56
{
57
return
$this->queries
;
58
}
59
65
public
function
setOrder
(
$order
)
66
{
67
$this->order = array();
68
69
if
(!is_array(
$order
))
70
{
71
$order
= array(
$order
);
72
}
73
74
foreach
(
$order
as $k => $v)
75
{
76
if
(is_numeric($k))
77
{
78
$this->
addOrder
($v);
79
}
80
else
81
{
82
$this->
addOrder
($k, $v);
83
}
84
}
85
86
return
$this;
87
}
88
96
public
function
addOrder
($definition,
$order
=
'ASC'
)
97
{
98
$order
= strtoupper(
$order
);
99
100
if
(!in_array(
$order
, array(
'ASC'
,
'DESC'
),
true
))
101
{
102
throw
new
ArgumentException
(sprintf(
'Invalid order "%s"'
,
$order
));
103
}
104
105
$helper = $this->connection->getSqlHelper();
106
107
if
(
$order
==
'ASC'
)
108
{
109
$order
= $helper->getAscendingOrder();
110
}
111
else
112
{
113
$order
= $helper->getDescendingOrder();
114
}
115
116
$this->order[$definition] =
$order
;
117
118
return
$this;
119
}
120
124
public
function
getOrder
()
125
{
126
return
$this->order
;
127
}
128
134
public
function
setLimit
(
$limit
)
135
{
136
$this->limit =
$limit
;
137
return
$this;
138
}
139
143
public
function
getLimit
()
144
{
145
return
$this->limit
;
146
}
147
153
public
function
setOffset
(
$offset
)
154
{
155
$this->offset =
$offset
;
156
return
$this;
157
}
158
162
public
function
getOffset
()
163
{
164
return
$this->offset
;
165
}
166
}
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\DB\Connection
Definition
connection.php:18
Bitrix\Main\Data\Connection
Definition
connection.php:17
Bitrix\Main\ORM\Query\UnionCondition
Definition
unioncondition.php:21
Bitrix\Main\ORM\Query\Union
Definition
union.php:20
Bitrix\Main\ORM\Query\Union\setOrder
setOrder($order)
Definition
union.php:65
Bitrix\Main\ORM\Query\Union\$connection
$connection
Definition
union.php:34
Bitrix\Main\ORM\Query\Union\__construct
__construct(Connection $connection)
Definition
union.php:36
Bitrix\Main\ORM\Query\Union\$order
$order
Definition
union.php:25
Bitrix\Main\ORM\Query\Union\getOrder
getOrder()
Definition
union.php:124
Bitrix\Main\ORM\Query\Union\addOrder
addOrder($definition, $order='ASC')
Definition
union.php:96
Bitrix\Main\ORM\Query\Union\$queries
$queries
Definition
union.php:22
Bitrix\Main\ORM\Query\Union\setOffset
setOffset($offset)
Definition
union.php:153
Bitrix\Main\ORM\Query\Union\addQuery
addQuery(UnionCondition $query)
Definition
union.php:46
Bitrix\Main\ORM\Query\Union\getQueries
getQueries()
Definition
union.php:55
Bitrix\Main\ORM\Query\Union\getLimit
getLimit()
Definition
union.php:143
Bitrix\Main\ORM\Query\Union\$limit
$limit
Definition
union.php:28
Bitrix\Main\ORM\Query\Union\$offset
$offset
Definition
union.php:31
Bitrix\Main\ORM\Query\Union\getOffset
getOffset()
Definition
union.php:162
Bitrix\Main\ORM\Query\Union\setLimit
setLimit($limit)
Definition
union.php:134
Bitrix\Main\ORM\Query
Definition
chain.php:3
modules
main
lib
orm
query
union.php
Создано системой
1.10.0