ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.arJoin.php
Go to the documentation of this file.
1<?php
2require_once(dirname(__FILE__) . '/../Statement/class.arStatement.php');
3
11class arJoin extends arStatement
12{
14 const TYPE_LEFT = 'LEFT';
15 const TYPE_RIGHT = 'RIGHT';
16 const TYPE_INNER = 'INNER';
24 protected $table_name = '';
28 protected $fields = array( '*' );
32 protected $operator = '=';
36 protected $on_first_field = '';
40 protected $on_second_field = '';
44 protected $full_names = false;
48 protected $both_external = false;
52 protected $is_mapped = false;
53
54
60 protected function asStatementText(ActiveRecord $ar, $as = ' AS ')
61 {
62 $return = ' ' . $this->getType() . ' ';
63 $return .= ' JOIN ' . $this->getTableName() . $as . $this->getTableNameAs();
64 if ($this->getBothExternal()) {
65 $return .= ' ON ' . $this->getOnFirstField() . ' ' . $this->getOperator() . ' ';
66 } else {
67 $return .= ' ON ' . $ar->getConnectorContainerName() . '.' . $this->getOnFirstField() . ' ' . $this->getOperator() . ' ';
68 }
69 $return .= $this->getTableNameAs() . '.' . $this->getOnSecondField();
70
71 return $return;
72 }
73
74
80 public function asSQLStatement(ActiveRecord $ar)
81 {
82 return $this->asStatementText($ar, ' AS ');
83 }
84
85
86 public function setLeft()
87 {
88 $this->setType(self::TYPE_LEFT);
89 }
90
91
92 public function setRght()
93 {
94 $this->setType(self::TYPE_RIGHT);
95 }
96
97
98 public function setInner()
99 {
100 $this->setType(self::TYPE_INNER);
101 }
102
103
107 public function setFields($fields)
108 {
109 $this->fields = $fields;
110 }
111
112
116 public function getFields()
117 {
118 return $this->fields;
119 }
120
121
126 {
127 $this->on_first_field = $on_first_field;
128 }
129
130
134 public function getOnFirstField()
135 {
137 }
138
139
144 {
145 $this->on_second_field = $on_second_field;
146 }
147
148
152 public function getOnSecondField()
153 {
155 }
156
157
161 public function setOperator($operator)
162 {
163 $this->operator = $operator;
164 }
165
166
170 public function getOperator()
171 {
172 return $this->operator;
173 }
174
175
179 public function setTableName($table_name)
180 {
181 $this->table_name = $table_name;
182 }
183
184
188 public function getTableName()
189 {
190 return $this->table_name;
191 }
192
193
197 public function setType($type)
198 {
199 $this->type = $type;
200 }
201
202
206 public function getType()
207 {
208 return $this->type;
209 }
210
211
216 {
217 $this->both_external = $both_external;
218 }
219
220
224 public function getBothExternal()
225 {
227 }
228
229
233 public function setFullNames($full_names)
234 {
235 $this->full_names = $full_names;
236 }
237
238
242 public function getFullNames()
243 {
244 return $this->full_names;
245 }
246
247
251 public function isIsMapped()
252 {
253 return $this->is_mapped;
254 }
255
256
260 public function setIsMapped($is_mapped)
261 {
262 $this->is_mapped = $is_mapped;
263 }
264}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Class arJoin.
setFields($fields)
const TYPE_INNER
asSQLStatement(ActiveRecord $ar)
getOnFirstField()
$on_second_field
setIsMapped($is_mapped)
asStatementText(ActiveRecord $ar, $as=' AS ')
const TYPE_NORMAL
setOperator($operator)
getBothExternal()
setBothExternal($both_external)
setFullNames($full_names)
getFullNames()
const TYPE_RIGHT
getTableName()
setTableName($table_name)
setOnSecondField($on_second_field)
const TYPE_LEFT
getOnSecondField()
setOnFirstField($on_first_field)
setType($type)
Class arStatement.
$errors fields
Definition: imgupload.php:51