ILIAS  release_8 Revision v8.24
class.ilADTActiveRecordBridge.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
5
13{
14 protected ilADT $adt;
15 protected ?string $id;
16 protected ?string $table;
17 protected array $primary = [];
18
19 public function __construct(ilADT $a_adt)
20 {
21 $this->setADT($a_adt);
22 }
23
24 abstract protected function isValidADT(ilADT $a_adt): bool;
25
31 protected function setADT(ilADT $a_adt): void
32 {
33 if (!$this->isValidADT($a_adt)) {
34 throw new \InvalidArgumentException('ADTActiveRecordBridge Type mismatch.');
35 }
36 $this->adt = $a_adt;
37 }
38
43 public function getADT(): ilADT
44 {
45 return $this->adt;
46 }
47
48 public function setTable(string $a_table): void
49 {
50 $this->table = $a_table;
51 }
52
53 public function getTable(): ?string
54 {
55 return $this->table;
56 }
57
62 public function setElementId(string $a_value): void
63 {
64 $this->id = $a_value;
65 }
66
71 public function getElementId(): ?string
72 {
73 return $this->id;
74 }
75
80 public function setPrimary(array $a_value): void
81 {
82 $this->primary = $a_value;
83 }
84
89 public function getPrimary(): array
90 {
91 return $this->primary;
92 }
93
98 abstract public function getActiveRecordFields(): array;
99
105 abstract public function getFieldValue(string $a_field_name);
106
112 abstract public function setFieldValue(string $a_field_name, $a_field_value): void;
113}
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:12