ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
13 {
14  protected $adt; // [ilADT]
15  protected $id; // [string]
16  protected $tabe; // [string]
17  protected $primary = []; // [array]
18 
25  public function __construct(ilADT $a_adt)
26  {
27  $this->setADT($a_adt);
28  }
29 
30 
31  //
32  // properties
33  //
34 
43  abstract protected function isValidADT(ilADT $a_adt);
44 
51  protected function setADT(ilADT $a_adt)
52  {
53  if (!$this->isValidADT($a_adt)) {
54  throw new Exception('ADTActiveRecordBridge Type mismatch.');
55  }
56 
57  $this->adt = $a_adt;
58  }
59 
65  public function getADT()
66  {
67  return $this->adt;
68  }
69 
75  public function setTable($a_table)
76  {
77  $this->table = (string) $a_table;
78  }
79 
85  public function getTable()
86  {
87  return $this->table;
88  }
89 
95  public function setElementId($a_value)
96  {
97  $this->id = (string) $a_value;
98  }
99 
105  public function getElementId()
106  {
107  return $this->id;
108  }
109 
115  public function setPrimary(array $a_value)
116  {
117  $this->primary = $a_value;
118  }
119 
125  public function getPrimary()
126  {
127  return $this->primary;
128  }
129 
130 
131  //
132  // active record
133  //
134 
140  abstract public function getActiveRecordFields();
141 
142 
149  abstract public function getFieldValue($a_field_name);
150 
157  abstract public function setFieldValue($a_field_name, $a_field_value);
158 }
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)