Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sectionconnection.php
1<?php
2
4
9use Bitrix\Calendar\Core;
14
16{
18 private ?int $id = null;
20 private ?string $vendorSectionId = null;
22 private ?string $syncToken = null;
24 private ?string $pageToken = null;
26 private ?Core\Section\Section $section = null;
28 private ?Connection $connection = null;
30 private bool $active = true;
32 private ?Date $lastSyncDate = null;
34 private ?string $lastSyncStatus = '';
36 private ?string $versionId = null;
38 private bool $primary = false;
42 protected ?Role $owner = null;
43
47 public function getConnection(): ?Sync\Connection\Connection
48 {
49 return $this->connection;
50 }
51
55 public function getPageToken(): ?string
56 {
57 return $this->pageToken;
58 }
59
63 public function getSyncToken(): ?string
64 {
65 return $this->syncToken;
66 }
67
72 public function setPageToken(?string $token): self
73 {
74 $this->pageToken = $token;
75
76 return $this;
77 }
78
83 public function setSyncToken(?string $token): self
84 {
85 $this->syncToken = $token;
86
87 return $this;
88 }
89
97 public function save(): self
98 {
99 if ($this->getId())
100 {
101 (new Core\Mappers\SectionConnection())->update($this);
102 }
103 else
104 {
105 (new Core\Mappers\SectionConnection())->create($this);
106 }
107
108 return $this;
109 }
110
114 public function getVendorSectionId(): ?string
115 {
116 return $this->vendorSectionId;
117 }
118
123 public function setConnection(?Connection $connection): self
124 {
125 $this->connection = $connection;
126
127 return $this;
128 }
129
135 public function setVendorSectionId(?string $vendorSectionId): self
136 {
137 $this->vendorSectionId = $vendorSectionId;
138
139 return $this;
140 }
141
145 public function getSection(): ?Section
146 {
147 return $this->section;
148 }
149
155 public function setSection(?Section $section): self
156 {
157 $this->section = $section;
158
159 return $this;
160 }
161
167 public function setActive(bool $active): self
168 {
169 $this->active = $active;
170
171 return $this;
172 }
173
177 public function isActive(): bool
178 {
179 return $this->active;
180 }
181
187 public function setLastSyncDate(?Core\Base\Date $lastSyncDate): self
188 {
189 $this->lastSyncDate = $lastSyncDate;
190
191 return $this;
192 }
193
197 public function getLastSyncDate(): ?Core\Base\Date
198 {
199 return $this->lastSyncDate;
200 }
201
207 public function setLastSyncStatus(?string $lastSyncStatus): self
208 {
209 $this->lastSyncStatus = $lastSyncStatus;
210
211 return $this;
212 }
213
217 public function getLastSyncStatus(): string
218 {
219 return $this->lastSyncStatus ?? '';
220 }
221
227 public function setVersionId(?string $versionId): self
228 {
229 $this->versionId = $versionId;
230
231 return $this;
232 }
233
237 public function getVersionId(): ?string
238 {
239 return $this->versionId;
240 }
241
247 public function setId(int $id): self
248 {
249 $this->id = $id;
250
251 return $this;
252 }
253
257 public function getId(): ?int
258 {
259 return $this->id;
260 }
261
265 public function isPrimary(): bool
266 {
267 return $this->primary;
268 }
269
275 public function setPrimary(bool $primary): self
276 {
277 $this->primary = $primary;
278
279 return $this;
280 }
281
286 public function setOwner(?Role $owner): self
287 {
288 $this->owner = $owner;
289
290 return $this;
291 }
292
296 public function getOwner(): ?Role
297 {
298 return $this->owner;
299 }
300
304 public function isNew(): bool
305 {
306 return $this->id === null;
307 }
308}