ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.arJoin.php
Go to the documentation of this file.
1<?php
2
25class arJoin extends arStatement
26{
28 public const TYPE_LEFT = 'LEFT';
29 public const TYPE_RIGHT = 'RIGHT';
30 public const TYPE_INNER = 'INNER';
31 public const AS_TEXT = ' AS ';
32 protected string $type = self::TYPE_NORMAL;
33 protected string $table_name = '';
34 protected array $fields = ['*'];
35 protected string $operator = '=';
36 protected string $on_first_field = '';
37 protected string $on_second_field = '';
38 protected bool $full_names = false;
39 protected bool $both_external = false;
40 protected bool $is_mapped = false;
41
42 protected function asStatementText(ActiveRecord $activeRecord, ilDBInterface $db, string $as = ' AS '): string
43 {
44 $return = ' ' . $this->getType() . ' ';
45 $return .= ' JOIN ' . $this->getTableName() . $as . $this->getTableNameAs();
46 if ($this->getBothExternal()) {
47 $return .= ' ON ' . $this->wrapField($this->getOnFirstField(), $db) . ' ' . $this->getOperator() . ' ';
48 } else {
49 $return .= ' ON '
50 . $this->wrapField(
51 $activeRecord->getConnectorContainerName() . '.' . $this->getOnFirstField(),
52 $db
53 )
54 . ' ' . $this->getOperator() . ' ';
55 }
56
57 return $return . $this->wrapField(
58 $this->getTableNameAs() . '.' .
59 $this->getOnSecondField(),
60 $db
61 );
62 }
63
64 public function asSQLStatement(ActiveRecord $activeRecord, ilDBInterface $db): string
65 {
66 return $this->asStatementText($activeRecord, $db, self::AS_TEXT);
67 }
68
69 public function setLeft(): void
70 {
71 $this->setType(self::TYPE_LEFT);
72 }
73
74 public function setRght(): void
75 {
76 $this->setType(self::TYPE_RIGHT);
77 }
78
79 public function setInner(): void
80 {
81 $this->setType(self::TYPE_INNER);
82 }
83
87 public function setFields(array $fields): void
88 {
89 $this->fields = $fields;
90 }
91
95 public function getFields(): array
96 {
97 return $this->fields;
98 }
99
100 public function setOnFirstField(string $on_first_field): void
101 {
102 $this->on_first_field = $on_first_field;
103 }
104
105 public function getOnFirstField(): string
106 {
108 }
109
110 public function setOnSecondField(string $on_second_field): void
111 {
112 $this->on_second_field = $on_second_field;
113 }
114
115 public function getOnSecondField(): string
116 {
118 }
119
120 public function setOperator(string $operator): void
121 {
122 $this->operator = $operator;
123 }
124
125 public function getOperator(): string
126 {
127 return $this->operator;
128 }
129
130 public function setTableName(string $table_name): void
131 {
132 $this->table_name = $table_name;
133 }
134
135 public function getTableName(): string
136 {
137 return $this->table_name;
138 }
139
140 public function setType(string $type): void
141 {
142 $this->type = $type;
143 }
144
145 public function getType(): string
146 {
147 return $this->type;
148 }
149
150 public function setBothExternal(bool $both_external): void
151 {
152 $this->both_external = $both_external;
153 }
154
155 public function getBothExternal(): bool
156 {
158 }
159
160 public function setFullNames(bool $full_names): void
161 {
162 $this->full_names = $full_names;
163 }
164
165 public function getFullNames(): bool
166 {
167 return $this->full_names;
168 }
169
170 public function isIsMapped(): bool
171 {
172 return $this->is_mapped;
173 }
174
175 public function setIsMapped(bool $is_mapped): void
176 {
177 $this->is_mapped = $is_mapped;
178 }
179}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getConnectorContainerName()
@description Return the Name of your Connector Table
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_INNER
getOnFirstField()
setTableName(string $table_name)
string $table_name
asStatementText(ActiveRecord $activeRecord, ilDBInterface $db, string $as=' AS ')
bool $is_mapped
const TYPE_NORMAL
string $operator
setOnSecondField(string $on_second_field)
setOperator(string $operator)
getBothExternal()
setFullNames(bool $full_names)
string $on_first_field
getFullNames()
setType(string $type)
const TYPE_RIGHT
getTableName()
setOnFirstField(string $on_first_field)
const AS_TEXT
array $fields
const TYPE_LEFT
setIsMapped(bool $is_mapped)
setBothExternal(bool $both_external)
asSQLStatement(ActiveRecord $activeRecord, ilDBInterface $db)
bool $full_names
setFields(array $fields)
getOnSecondField()
string $on_second_field
bool $both_external
string $type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
wrapField(string $field, ilDBInterface $db)
Interface ilDBInterface.