ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTActiveRecordBridge.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
27{
28 protected ilADT $adt;
29 protected ?string $id;
30 protected ?string $table;
31 protected array $primary = [];
32
33 public function __construct(ilADT $a_adt)
34 {
35 $this->setADT($a_adt);
36 }
37
38 abstract protected function isValidADT(ilADT $a_adt): bool;
39
45 protected function setADT(ilADT $a_adt): void
46 {
47 if (!$this->isValidADT($a_adt)) {
48 throw new \InvalidArgumentException('ADTActiveRecordBridge Type mismatch.');
49 }
50 $this->adt = $a_adt;
51 }
52
57 public function getADT(): ilADT
58 {
59 return $this->adt;
60 }
61
62 public function setTable(string $a_table): void
63 {
64 $this->table = $a_table;
65 }
66
67 public function getTable(): ?string
68 {
69 return $this->table;
70 }
71
76 public function setElementId(string $a_value): void
77 {
78 $this->id = $a_value;
79 }
80
85 public function getElementId(): ?string
86 {
87 return $this->id;
88 }
89
94 public function setPrimary(array $a_value): void
95 {
96 $this->primary = $a_value;
97 }
98
103 public function getPrimary(): array
104 {
105 return $this->primary;
106 }
107
112 abstract public function getActiveRecordFields(): array;
113
119 abstract public function getFieldValue(string $a_field_name);
120
126 abstract public function setFieldValue(string $a_field_name, $a_field_value): void;
127}
setPrimary(array $a_value)
Set primary fields (in MDB2 format)
setFieldValue(string $a_field_name, $a_field_value)
Set field value.
isValidADT(ilADT $a_adt)
setElementId(string $a_value)
Set element id (aka DB column[s] [prefix])
getActiveRecordFields()
Convert ADT to active record fields.
getFieldValue(string $a_field_name)
Get field value.
ADT base class.
Definition: class.ilADT.php:26