ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilADTActiveRecordBridge.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "Services/ActiveRecord/classes/Fields/class.arField.php";
5 
14 {
15  protected $adt; // [ilADT]
16  protected $id; // [string]
17  protected $tabe; // [string]
18  protected $primary = []; // [array]
19 
26  public function __construct(ilADT $a_adt)
27  {
28  $this->setADT($a_adt);
29  }
30 
31 
32  //
33  // properties
34  //
35 
44  abstract protected function isValidADT(ilADT $a_adt);
45 
52  protected function setADT(ilADT $a_adt)
53  {
54  if (!$this->isValidADT($a_adt)) {
55  throw new Exception('ADTActiveRecordBridge Type mismatch.');
56  }
57 
58  $this->adt = $a_adt;
59  }
60 
66  public function getADT()
67  {
68  return $this->adt;
69  }
70 
76  public function setTable($a_table)
77  {
78  $this->table = (string) $a_table;
79  }
80 
86  public function getTable()
87  {
88  return $this->table;
89  }
90 
96  public function setElementId($a_value)
97  {
98  $this->id = (string) $a_value;
99  }
100 
106  public function getElementId()
107  {
108  return $this->id;
109  }
110 
116  public function setPrimary(array $a_value)
117  {
118  $this->primary = $a_value;
119  }
120 
126  public function getPrimary()
127  {
128  return $this->primary;
129  }
130 
131 
132  //
133  // active record
134  //
135 
141  abstract public function getActiveRecordFields();
142 
143 
150  abstract public function getFieldValue($a_field_name);
151 
158  abstract public function setFieldValue($a_field_name, $a_field_value);
159 }
setFieldValue($a_field_name, $a_field_value)
Set field value.
getActiveRecordFields()
Convert ADT to active record fields.
ADT base class.
Definition: class.ilADT.php:11
isValidADT(ilADT $a_adt)
Check if given ADT is valid.
setElementId($a_value)
Set element id (aka DB column[s] [prefix])
setTable($a_table)
Set table name.
__construct(ilADT $a_adt)
Constructor.
getFieldValue($a_field_name)
Get field value.
setPrimary(array $a_value)
Set primary fields (in MDB2 format)
if(empty($password)) $table
Definition: pwgen.php:24