1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
builderpushfromdm.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Sync\Builders;
4
5use Bitrix\Calendar\Core\Base\Date;
6use Bitrix\Calendar\Core\Builders\Builder;
7use Bitrix\Calendar\Internals\EO_Push;
8use Bitrix\Calendar\Sync\Dictionary;
9use Bitrix\Calendar\Sync\Push\Push;
10use Bitrix\Main\ObjectException;
11
12class BuilderPushFromDM implements Builder
13{
14 private EO_Push $push;
15
19 public function __construct(EO_Push $push)
20 {
21 $this->push = $push;
22 }
23
29 public function build(): Push
30 {
31 return ( new Push())
32 ->setEntityType($this->push->getEntityType())
33 ->setEntityId($this->push->getEntityId())
34 ->setChannelId($this->push->getChannelId())
35 ->setResourceId($this->push->getResourceId())
36 ->setExpireDate($this->getExpireDate())
37 ->setProcessStatus($this->push->getNotProcessed() ?? Dictionary::PUSH_STATUS_PROCESS['unblocked'])
38 ->setFirstPushDate($this->getFirstPushDate())
39 ;
40 }
41
47 private function getExpireDate(): Date
48 {
49 return new Date($this->push->getExpires());
50 }
51
57 private function getFirstPushDate(): ?Date
58 {
59 return $this->push->getFirstPushDate()
60 ? new Date($this->push->getFirstPushDate())
61 : null;
62 }
63}
const PUSH_STATUS_PROCESS
Определения dictionary.php:33
setEntityType(string $entityType)
Определения push.php:51
Определения date.php:9