1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Event.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Sync;
4
5use Bitrix\Im\Model\EO_Log_Collection;
6use Bitrix\Main\Type\DateTime;
7
8class Event
9{
10 public const DELETE_EVENT = 'delete';
11 public const COMPLETE_DELETE_EVENT = 'completeDelete';
12 public const ADD_EVENT = 'add';
13 public const READ_ALL_EVENT = 'readAll';
14 public const CHAT_ENTITY = 'chat';
15 public const PIN_MESSAGE_ENTITY = 'pin';
16 public const MESSAGE_ENTITY = 'message';
17 public const UPDATED_MESSAGE_ENTITY = 'updatedMessage';
18
19 private ?int $id;
20 private DateTime $dateCreate;
21 private ?DateTime $dateDelete;
22 public string $entityType;
23 public int $entityId;
24 public string $eventName;
25
26 public function __construct(
27 string $eventName,
28 string $entityType,
29 int $entityId,
30 ?DateTime $dateDelete = null,
31 ?DateTime $dateCreate = null,
32 ?int $id = null
33 )
34 {
35 $dateCreate ??= new DateTime();
36 if ($dateDelete === null)
37 {
38 $dateDelete = clone $dateCreate;
39 $dateDelete->add(Logger::DEFAULT_EXPIRY_INTERVAL);
40 }
41 $this->eventName = $eventName;
42 $this->entityType = $entityType;
43 $this->entityId = $entityId;
44 $this->dateDelete = $dateDelete;
45 $this->dateCreate = $dateCreate;
46 $this->id = $id;
47 }
48
49 public function getId(): ?int
50 {
51 return $this->id;
52 }
53
54 public function getDateCreate(): DateTime
55 {
56 return $this->dateCreate;
57 }
58
59 public function getDateDelete(): ?DateTime
60 {
61 return $this->dateDelete;
62 }
63
64 public static function initByArray(array $logEntities): array
65 {
66 $events = [];
67
68 foreach ($logEntities as $entity)
69 {
70 $events[] = new self(
71 $entity['EVENT'] ?? '',
72 $entity['ENTITY_TYPE'] ?? '',
73 $entity['ENTITY_ID'] ?? 0,
74 $entity['DATE_CREATE'] ?? null,
75 $entity['DATE_DELETE'] ?? null,
76 $entity['ID'] ?? null
77 );
78 }
79
80 return $events;
81 }
82}
getId()
Определения Event.php:49
getDateDelete()
Определения Event.php:59
const DELETE_EVENT
Определения Event.php:10
getDateCreate()
Определения Event.php:54
static initByArray(array $logEntities)
Определения Event.php:64
const READ_ALL_EVENT
Определения Event.php:13
const PIN_MESSAGE_ENTITY
Определения Event.php:15
const COMPLETE_DELETE_EVENT
Определения Event.php:11
const UPDATED_MESSAGE_ENTITY
Определения Event.php:17
const MESSAGE_ENTITY
Определения Event.php:16
string $entityType
Определения Event.php:22
const ADD_EVENT
Определения Event.php:12
__construct(string $eventName, string $entityType, int $entityId, ?DateTime $dateDelete=null, ?DateTime $dateCreate=null, ?int $id=null)
Определения Event.php:26
const CHAT_ENTITY
Определения Event.php:14
int $entityId
Определения Event.php:23
string $eventName
Определения Event.php:24
const DEFAULT_EXPIRY_INTERVAL
Определения Logger.php:20
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$entity