Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
Messages.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Sync\Entity
;
4
5
use
Bitrix\Im\V2\MessageCollection
;
6
use
Bitrix\Im\V2\Rest\RestAdapter
;
7
use
Bitrix\Im\V2\Sync\Entity
;
8
use
Bitrix\Im\V2\Sync\Event
;
9
10
class
Messages
implements
Entity
11
{
12
private
array $messageIds = [];
13
private
array $completeDeletedMessageIds = [];
14
15
public
function
add
(
Event
$event): void
16
{
17
$entityId = $event->entityId;
18
switch
($event->eventName)
19
{
20
case
Event::COMPLETE_DELETE_EVENT
:
21
$this->completeDeletedMessageIds[$entityId] = $entityId;
22
break
;
23
case
Event::ADD_EVENT
:
24
case
Event::DELETE_EVENT
:
25
$this->messageIds[$entityId] = $entityId;
26
break
;
27
}
28
}
29
30
public
function
getData
(): array
31
{
32
$fullMessage =
new
MessageCollection
($this->messageIds);
33
34
return
[
35
'messages'
=> (
new
RestAdapter
($fullMessage))->toRestFormat(),
36
'completeDeletedMessages'
=> $this->completeDeletedMessageIds,
37
];
38
}
39
}
Bitrix\Im\V2\MessageCollection
Definition
MessageCollection.php:35
Bitrix\Im\V2\Rest\RestAdapter
Definition
RestAdapter.php:6
Bitrix\Im\V2\Sync\Entity\Messages
Definition
Messages.php:11
Bitrix\Im\V2\Sync\Entity\Messages\add
add(Event $event)
Definition
Messages.php:15
Bitrix\Im\V2\Sync\Entity\Messages\getData
getData()
Definition
Messages.php:30
Bitrix\Im\V2\Sync\Event
Definition
Event.php:9
Bitrix\Im\V2\Sync\Event\DELETE_EVENT
const DELETE_EVENT
Definition
Event.php:10
Bitrix\Im\V2\Sync\Event\COMPLETE_DELETE_EVENT
const COMPLETE_DELETE_EVENT
Definition
Event.php:11
Bitrix\Im\V2\Sync\Event\ADD_EVENT
const ADD_EVENT
Definition
Event.php:12
Bitrix\Im\V2\Sync\Entity
Definition
Entity.php:6
Bitrix\Im\V2\Sync\Entity
Definition
Chats.php:3
modules
im
lib
V2
Sync
Entity
Messages.php
Создано системой
1.10.0