Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
buildereventconnectionfromexternalevent.php
1<?php
2
4
10
12{
13 private array $externalEvent;
14 private SyncEvent $syncEvent;
15 private Connection $connection;
16
17 public function __construct(array $externalEvent, SyncEvent $syncEvent, Connection $connection)
18 {
19 $this->externalEvent = $externalEvent;
20 $this->syncEvent = $syncEvent;
21 $this->connection = $connection;
22 }
23
27 public function build(): EventConnection
28 {
29 $id = null;
30 if ($eventConnection = $this->syncEvent->getEventConnection())
31 {
32 $id = $eventConnection->getId();
33 }
34
35 return (new EventConnection())
36 ->setEntityTag($this->externalEvent['etag'] ?? null)
37 ->setVendorEventId($this->externalEvent['id'] ?? null)
38 ->setVendorVersionId($this->externalEvent['sequence'] ?? null)
39 ->setVersion($this->syncEvent->getEvent()->getVersion())
40 ->setRecurrenceId($this->externalEvent['recurringEventId'] ?? null)
41 ->setRetryCount(0)
42 ->setLastSyncStatus('success')
43 ->setEvent($this->syncEvent->getEvent())
44 ->setConnection($this->connection)
45 ->setId($id)
46 ;
47 }
48}
__construct(array $externalEvent, SyncEvent $syncEvent, Connection $connection)