Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ReminderPopupItem.php
1<?php
2
4
6
8{
9 // todo refactor this. replace with lazy load
10 private ReminderCollection $reminders;
11
12 public function __construct($reminders = null)
13 {
14 if (!$reminders instanceof ReminderCollection)
15 {
16 $this->reminders = new ReminderCollection();
17 }
18 else
19 {
20 $this->reminders = $reminders;
21 }
22
23 if ($reminders instanceof ReminderItem)
24 {
25 if ($this->reminders[$reminders->getId()] === null)
26 {
27 $this->reminders->add($reminders);
28 }
29 }
30 }
31
32 public function merge(PopupDataItem $item): self
33 {
34 if ($item instanceof self)
35 {
36 foreach ($item->reminders as $reminder)
37 {
38 if (!isset($this->reminders[$reminder->getId()]))
39 {
40 $this->reminders->add($reminder);
41 }
42 }
43 }
44
45 return $this;
46 }
47
48 public static function getRestEntityName(): string
49 {
50 return 'reminders';
51 }
52
53 public function toRestFormat(array $option = []): array
54 {
55 $option['WITHOUT_MESSAGES'] = 'Y';
56 return $this->reminders->toRestFormat($option);
57 }
58}
add(ActiveRecord $entry)