ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.arJoinCollection.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  protected array $table_names = [];
27 
31  public function getSaveTableName(arStatement $arStatement): string
32  {
33  $tableName = $arStatement->getTableName();
34  if (in_array($tableName, $this->table_names, true)) {
35  $vals = array_count_values($this->table_names);
36  $next = $vals[$tableName] + 1;
37  $arStatement->setFullNames(true);
38  $arStatement->setIsMapped(true);
39 
40  return $tableName . '_' . $next;
41  }
42  return $tableName;
43  }
44 
45  public function add(arStatement $arStatement): void
46  {
47  $arStatement->setTableNameAs($this->getSaveTableName($arStatement));
48  $this->table_names[] = $arStatement->getTableName();
49  parent::add($arStatement);
50  }
51 
52  public function asSQLStatement(ilDBInterface $db): string
53  {
54  $return = '';
55  if ($this->hasStatements()) {
56  foreach ($this->getJoins() as $arJoin) {
57  $return .= $arJoin->asSQLStatement($this->getAr(), $db);
58  }
59  }
60 
61  return $return;
62  }
63 
67  public function getJoins(): array
68  {
69  return $this->statements;
70  }
71 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
asSQLStatement(ilDBInterface $db)
setTableNameAs(string $table_name_as)
getSaveTableName(arStatement $arStatement)
add(arStatement $arStatement)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...