1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
union.php
См. документацию.
1<?php
8
9namespace Bitrix\Main\ORM\Query;
10use Bitrix\Main\ArgumentException;
11use Bitrix\Main\DB\Connection;
12
19class Union
20{
22 protected $queries;
23
25 protected $order;
26
28 protected $limit;
29
31 protected $offset;
32
34 protected $connection;
35
37 {
38 $this->connection = $connection;
39 }
40
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 {
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}
setOrder($order)
Определения union.php:65
$connection
Определения union.php:34
__construct(Connection $connection)
Определения union.php:36
getOrder()
Определения union.php:124
addOrder($definition, $order='ASC')
Определения union.php:96
setOffset($offset)
Определения union.php:153
addQuery(UnionCondition $query)
Определения union.php:46
getQueries()
Определения union.php:55
getLimit()
Определения union.php:143
getOffset()
Определения union.php:162
setLimit($limit)
Определения union.php:134
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$query
Определения get_search.php:11
$k
Определения template_pdf.php:567