ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.arJoin.php
Go to the documentation of this file.
1 <?php
2 require_once(dirname(__FILE__) . '/../Statement/class.arStatement.php');
3 
11 class arJoin extends arStatement
12 {
13  const TYPE_NORMAL = self::TYPE_INNER;
14  const TYPE_LEFT = 'LEFT';
15  const TYPE_RIGHT = 'RIGHT';
16  const TYPE_INNER = 'INNER';
20  protected $type = self::TYPE_NORMAL;
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  {
136  return $this->on_first_field;
137  }
138 
139 
144  {
145  $this->on_second_field = $on_second_field;
146  }
147 
148 
152  public function getOnSecondField()
153  {
154  return $this->on_second_field;
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  {
226  return $this->both_external;
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 arJoin.
setOnFirstField($on_first_field)
const TYPE_LEFT
Class ActiveRecord.
setIsMapped($is_mapped)
getFullNames()
const TYPE_INNER
setTableName($table_name)
getTableName()
Class arStatement.
setOperator($operator)
$errors fields
Definition: imgupload.php:51
getBothExternal()
setFullNames($full_names)
asSQLStatement(ActiveRecord $ar)
const TYPE_NORMAL
setOnSecondField($on_second_field)
$as
getOnFirstField()
const TYPE_RIGHT
$on_second_field
setType($type)
setBothExternal($both_external)
getOnSecondField()
asStatementText(ActiveRecord $ar, $as=' AS ')
setFields($fields)