ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
GenericDataImplementation.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
27{
28 protected ?int $id;
29
30 public function __construct(
31 protected Type $type,
32 protected int $record_id,
33 protected string $import_id,
34 protected string $title,
35 protected string $description,
36 protected int $position,
37 protected bool $searchable,
38 protected bool $required,
39 protected array $field_values,
40 ?int $id = null
41 ) {
42 $this->id = $id;
43 }
44
45 public function id(): ?int
46 {
47 return $this->id;
48 }
49
50 public function type(): Type
51 {
52 return $this->type;
53 }
54
55 public function isPersisted(): bool
56 {
57 return !is_null($this->id());
58 }
59
60 protected function getSubData(): \Generator
61 {
62 yield from [];
63 }
64
65
66 public function getRecordID(): int
67 {
68 return $this->record_id;
69 }
70
71 public function setRecordID(int $id): void
72 {
73 if ($id === $this->record_id) {
74 return;
75 }
76 $this->record_id = $id;
77 $this->markAsChanged();
78 }
79
80 public function getImportID(): string
81 {
82 return $this->import_id;
83 }
84
85 public function setImportID(string $id): void
86 {
87 if ($id === $this->import_id) {
88 return;
89 }
90 $this->import_id = $id;
91 $this->markAsChanged();
92 }
93
94 public function getTitle(): string
95 {
96 return $this->title;
97 }
98
99 public function setTitle(string $title): void
100 {
101 if ($title === $this->title) {
102 return;
103 }
104 $this->title = $title;
105 $this->markAsChanged();
106 }
107
108 public function getDescription(): string
109 {
110 return $this->description;
111 }
112
113 public function setDescription(string $description): void
114 {
115 if ($description === $this->description) {
116 return;
117 }
118 $this->description = $description;
119 $this->markAsChanged();
120 }
121
122 public function getPosition(): int
123 {
124 return $this->position;
125 }
126
127 public function setPosition(int $position): void
128 {
129 if ($position === $this->position) {
130 return;
131 }
132 $this->position = $position;
133 $this->markAsChanged();
134 }
135
136 public function isSearchable(): bool
137 {
138 return $this->searchable;
139 }
140
141 public function setSearchable(bool $searchable): void
142 {
143 if ($searchable === $this->searchable) {
144 return;
145 }
146 $this->searchable = $searchable;
147 $this->markAsChanged();
148 }
149
150 public function isRequired(): bool
151 {
152 return $this->required;
153 }
154
155 public function setRequired(bool $required): void
156 {
157 if ($required === $this->required) {
158 return;
159 }
160 $this->required = $required;
161 $this->markAsChanged();
162 }
163
164 public function getFieldValues(): array
165 {
166 return $this->field_values;
167 }
168
169 public function setFieldValues(array $values): void
170 {
171 if ($values === $this->field_values) {
172 return;
173 }
174 $this->field_values = $values;
175 $this->markAsChanged();
176 }
177}
__construct(protected Type $type, protected int $record_id, protected string $import_id, protected string $title, protected string $description, protected int $position, protected bool $searchable, protected bool $required, protected array $field_values, ?int $id=null)