Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
handler.php
1
<?php
2
3
namespace
Bitrix\Calendar\Watcher\Membership\Handler
;
4
5
abstract
class
Handler
6
{
7
const
WORK_GROUP_TYPE
=
'project'
;
8
const
DEPARTMENT_TYPE
=
'department'
;
9
const
ALL_USERS_TYPE
=
'all-users'
;
10
11
protected
static
array
$storedData
= [];
12
17
protected
static
function
sendBatchOfMessagesToQueue
(array $data): void
18
{
19
$messages = [];
20
foreach
($data as $datum)
21
{
22
if
(!empty($datum[
'entityType'
]) && !empty($datum[
'entityId'
]))
23
{
24
$messages[] = (new \Bitrix\Calendar\Core\Queue\Message\Message())
25
->setBody([
26
'entityType'
=> $datum[
'entityType'
],
27
'entityId'
=> $datum[
'entityId'
],
28
])
29
->setRoutingKey(
'calendar:find_events_with_entity_attendees'
)
30
;
31
}
32
}
33
34
(new \Bitrix\Calendar\Core\Queue\Producer\Producer())->sendBatch($messages);
35
}
36
42
protected
static
function
sendMessageToQueue
(
string
$entityType, $entityId =
null
): void
43
{
44
$message = (new \Bitrix\Calendar\Core\Queue\Message\Message())
45
->setBody([
46
'entityType'
=> $entityType,
47
'entityId'
=> $entityId,
48
])
49
->setRoutingKey(
'calendar:find_events_with_entity_attendees'
)
50
;
51
52
(new \Bitrix\Calendar\Core\Queue\Producer\Producer())->send($message);
53
}
54
}
Bitrix\Calendar\Watcher\Membership\Handler\Handler
Definition
handler.php:6
Bitrix\Calendar\Watcher\Membership\Handler\Handler\$storedData
static array $storedData
Definition
handler.php:11
Bitrix\Calendar\Watcher\Membership\Handler\Handler\WORK_GROUP_TYPE
const WORK_GROUP_TYPE
Definition
handler.php:7
Bitrix\Calendar\Watcher\Membership\Handler\Handler\DEPARTMENT_TYPE
const DEPARTMENT_TYPE
Definition
handler.php:8
Bitrix\Calendar\Watcher\Membership\Handler\Handler\ALL_USERS_TYPE
const ALL_USERS_TYPE
Definition
handler.php:9
Bitrix\Calendar\Watcher\Membership\Handler\Handler\sendMessageToQueue
static sendMessageToQueue(string $entityType, $entityId=null)
Definition
handler.php:42
Bitrix\Calendar\Watcher\Membership\Handler\Handler\sendBatchOfMessagesToQueue
static sendBatchOfMessagesToQueue(array $data)
Definition
handler.php:17
Bitrix\Calendar\Watcher\Membership\Handler
Definition
department.php:3
modules
calendar
lib
watcher
membership
handler
handler.php
Создано системой
1.10.0