ILIAS  release_8 Revision v8.24
class.arJoin.php
Go to the documentation of this file.
1<?php
2
24class arJoin extends arStatement
25{
27 public const TYPE_LEFT = 'LEFT';
28 public const TYPE_RIGHT = 'RIGHT';
29 public const TYPE_INNER = 'INNER';
30 public const AS_TEXT = ' AS ';
31 protected string $type = self::TYPE_NORMAL;
32 protected string $table_name = '';
33 protected array $fields = ['*'];
34 protected string $operator = '=';
35 protected string $on_first_field = '';
36 protected string $on_second_field = '';
37 protected bool $full_names = false;
38 protected bool $both_external = false;
39 protected bool $is_mapped = false;
40
41 protected function asStatementText(ActiveRecord $activeRecord, ilDBInterface $db, string $as = ' AS '): string
42 {
43 $return = ' ' . $this->getType() . ' ';
44 $return .= ' JOIN ' . $this->getTableName() . $as . $this->getTableNameAs();
45 if ($this->getBothExternal()) {
46 $return .= ' ON ' . $db->quoteIdentifier($this->getOnFirstField()) . ' ' . $this->getOperator() . ' ';
47 } else {
48 $return .= ' ON ' . $db->quoteIdentifier($activeRecord->getConnectorContainerName()) . '.' . $this->getOnFirstField(
49 ) . ' ' . $this->getOperator() . ' ';
50 }
51
52 return $return . $db->quoteIdentifier($this->getTableNameAs()) . '.' . $db->quoteIdentifier($this->getOnSecondField());
53 }
54
55 public function asSQLStatement(ActiveRecord $activeRecord, ilDBInterface $db): string
56 {
57 return $this->asStatementText($activeRecord, $db, self::AS_TEXT);
58 }
59
60 public function setLeft(): void
61 {
62 $this->setType(self::TYPE_LEFT);
63 }
64
65 public function setRght(): void
66 {
67 $this->setType(self::TYPE_RIGHT);
68 }
69
70 public function setInner(): void
71 {
72 $this->setType(self::TYPE_INNER);
73 }
74
75 public function setFields(array $fields): void
76 {
77 $this->fields = $fields;
78 }
79
80 public function getFields(): array
81 {
82 return $this->fields;
83 }
84
85 public function setOnFirstField(string $on_first_field): void
86 {
87 $this->on_first_field = $on_first_field;
88 }
89
90 public function getOnFirstField(): string
91 {
93 }
94
95 public function setOnSecondField(string $on_second_field): void
96 {
97 $this->on_second_field = $on_second_field;
98 }
99
100 public function getOnSecondField(): string
101 {
103 }
104
105 public function setOperator(string $operator): void
106 {
107 $this->operator = $operator;
108 }
109
110 public function getOperator(): string
111 {
112 return $this->operator;
113 }
114
115 public function setTableName(string $table_name): void
116 {
117 $this->table_name = $table_name;
118 }
119
120 public function getTableName(): string
121 {
122 return $this->table_name;
123 }
124
125 public function setType(string $type): void
126 {
127 $this->type = $type;
128 }
129
130 public function getType(): string
131 {
132 return $this->type;
133 }
134
135 public function setBothExternal(bool $both_external): void
136 {
137 $this->both_external = $both_external;
138 }
139
140 public function getBothExternal(): bool
141 {
143 }
144
145 public function setFullNames(bool $full_names): void
146 {
147 $this->full_names = $full_names;
148 }
149
150 public function getFullNames(): bool
151 {
152 return $this->full_names;
153 }
154
155 public function isIsMapped(): bool
156 {
157 return $this->is_mapped;
158 }
159
160 public function setIsMapped(bool $is_mapped): void
161 {
162 $this->is_mapped = $is_mapped;
163 }
164}
Class ActiveRecord.
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...
$errors fields
Definition: imgupload.php:67
Interface ilDBInterface.
quoteIdentifier(string $identifier, bool $check_option=false)