1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
PromotionUpdateEvent.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Im\V2\Promotion\Event\Update;
6
7use Bitrix\Im\V2\Chat;
8use Bitrix\Im\V2\Promotion\Promotion;
9use Bitrix\Im\V2\Pull\BaseEvent;
10use Bitrix\Im\V2\Pull\Dto\Diff;
11use Bitrix\Im\V2\Pull\EventType;
12use Bitrix\Main\DI\ServiceLocator;
13use Bitrix\Main\Validation\ValidationService;
14
16{
18 private array $sortedByUserData;
19 private ValidationService $validation;
20
22 public function __construct(array $sortedByUserData)
23 {
24 parent::__construct();
25
26 $this->validation = ServiceLocator::getInstance()->get('main.validation.service');
27 $this->sortedByUserData = $this->prepareData($sortedByUserData);
28 }
29
34 private function prepareData(array $sortedByUserData): array
35 {
37 {
38 return [];
39 }
40
41 $preparedData = [];
42 foreach ($sortedByUserData as $userId => $command)
43 {
44 $validationResult = $this->validation->validate($command);
45 if ($validationResult->isSuccess())
46 {
47 $preparedData[$userId] = $command->toRestFormat();
48 }
49 }
50
51 return $preparedData;
52 }
53
54 protected function getRecipients(): array
55 {
56 return array_keys($this->sortedByUserData);
57 }
58
59 protected function getDiffByUser(int $userId): Diff
60 {
61 return new Diff($userId, $this->sortedByUserData[$userId]);
62 }
63
64 protected function getType(): EventType
65 {
66 return EventType::PromotionUpdated;
67 }
68
69 protected function getBasePullParamsInternal(): array
70 {
71 return [];
72 }
73
74 public function getTarget(): ?Chat
75 {
76 return null;
77 }
78}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static isUnavailable()
Определения Promotion.php:69
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
EventType
Определения EventType.php:6