Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
Event.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Sync
;
4
5
use Bitrix\Im\Model\EO_Log_Collection;
6
use
Bitrix\Main\Type\DateTime
;
7
8
class
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
18
private
?
int
$id;
19
private
DateTime
$dateCreate;
20
private
?
DateTime
$dateDelete;
21
public
string
$entityType
;
22
public
int
$entityId
;
23
public
string
$eventName
;
24
25
public
function
__construct
(
26
string
$eventName
,
27
string
$entityType
,
28
int
$entityId
,
29
?
DateTime
$dateDelete =
null
,
30
?
DateTime
$dateCreate =
null
,
31
?
int
$id =
null
32
)
33
{
34
$dateCreate ??=
new
DateTime
();
35
if
($dateDelete ===
null
)
36
{
37
$dateDelete = clone $dateCreate;
38
$dateDelete->
add
(
Logger::DEFAULT_EXPIRY_INTERVAL
);
39
}
40
$this->eventName =
$eventName
;
41
$this->entityType =
$entityType
;
42
$this->entityId =
$entityId
;
43
$this->dateDelete = $dateDelete;
44
$this->dateCreate = $dateCreate;
45
$this->
id
= $id;
46
}
47
48
public
function
getId
(): ?int
49
{
50
return
$this->id;
51
}
52
53
public
function
getDateCreate
():
DateTime
54
{
55
return
$this->dateCreate;
56
}
57
58
public
function
getDateDelete
(): ?
DateTime
59
{
60
return
$this->dateDelete;
61
}
62
67
public
static
function
initByOrmEntities
(EO_Log_Collection $logCollection): array
68
{
69
$events = [];
70
71
foreach
($logCollection as $logItem)
72
{
73
$events[] =
new
self
(
74
$logItem->getEvent(),
75
$logItem->getEntityType(),
76
$logItem->getEntityId(),
77
$logItem->getDateCreate(),
78
$logItem->getDateDelete(),
79
$logItem->getId()
80
);
81
}
82
83
return
$events;
84
}
85
}
Bitrix\Im\V2\Sync\Event
Definition
Event.php:9
Bitrix\Im\V2\Sync\Event\getId
getId()
Definition
Event.php:48
Bitrix\Im\V2\Sync\Event\getDateDelete
getDateDelete()
Definition
Event.php:58
Bitrix\Im\V2\Sync\Event\DELETE_EVENT
const DELETE_EVENT
Definition
Event.php:10
Bitrix\Im\V2\Sync\Event\getDateCreate
getDateCreate()
Definition
Event.php:53
Bitrix\Im\V2\Sync\Event\READ_ALL_EVENT
const READ_ALL_EVENT
Definition
Event.php:13
Bitrix\Im\V2\Sync\Event\PIN_MESSAGE_ENTITY
const PIN_MESSAGE_ENTITY
Definition
Event.php:15
Bitrix\Im\V2\Sync\Event\COMPLETE_DELETE_EVENT
const COMPLETE_DELETE_EVENT
Definition
Event.php:11
Bitrix\Im\V2\Sync\Event\initByOrmEntities
static initByOrmEntities(EO_Log_Collection $logCollection)
Definition
Event.php:67
Bitrix\Im\V2\Sync\Event\MESSAGE_ENTITY
const MESSAGE_ENTITY
Definition
Event.php:16
Bitrix\Im\V2\Sync\Event\$entityType
string $entityType
Definition
Event.php:21
Bitrix\Im\V2\Sync\Event\ADD_EVENT
const ADD_EVENT
Definition
Event.php:12
Bitrix\Im\V2\Sync\Event\__construct
__construct(string $eventName, string $entityType, int $entityId, ?DateTime $dateDelete=null, ?DateTime $dateCreate=null, ?int $id=null)
Definition
Event.php:25
Bitrix\Im\V2\Sync\Event\CHAT_ENTITY
const CHAT_ENTITY
Definition
Event.php:14
Bitrix\Im\V2\Sync\Event\$entityId
int $entityId
Definition
Event.php:22
Bitrix\Im\V2\Sync\Event\$eventName
string $eventName
Definition
Event.php:23
Bitrix\Im\V2\Sync\Logger\DEFAULT_EXPIRY_INTERVAL
const DEFAULT_EXPIRY_INTERVAL
Definition
Logger.php:19
Bitrix\Main\Type\Date\add
add($interval)
Definition
date.php:145
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Im\V2\Sync
Definition
Entity.php:3
modules
im
lib
V2
Sync
Event.php
Создано системой
1.10.0