ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.arJoinCollection.php
Go to the documentation of this file.
1 <?php
2 require_once(dirname(__FILE__) . '/../Statement/class.arStatementCollection.php');
3 require_once('class.arJoin.php');
4 
12 
16  protected $table_names = array();
17 
18 
24  public function getSaveTableName(arJoin $statement) {
25  $table_name = $statement->getTableName();
26  if (in_array($table_name, $this->table_names)) {
27  $vals = array_count_values($this->table_names);
28  $next = $vals[$table_name] + 1;
29  $statement->setFullNames(true);
30  $statement->setIsMapped(true);
31 
32  return $table_name . '_' . $next;
33  } else {
34  return $table_name;
35  }
36  }
37 
38 
42  public function add(arStatement $statement) {
43  $statement->setTableNameAs($this->getSaveTableName($statement));
44  $this->table_names[] = $statement->getTableName();
45  parent::add($statement);
46  }
47 
48 
52  public function asSQLStatement() {
53  $return = '';
54  if ($this->hasStatements()) {
55  foreach ($this->getJoins() as $join) {
56  $return .= $join->asSQLStatement($this->getAr());
57  }
58  }
59 
60  return $return;
61  }
62 
63 
67  public function getJoins() {
68  return $this->statements;
69  }
70 }
71 
72 ?>