1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
QueueItem.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Integration\HumanResources\Sync\Item;
4
5use Bitrix\Im\Model\HrSyncQueueTable;
6use Bitrix\Main\Type\DateTime;
7
9{
10 public function __construct(
11 public readonly int $id,
12 public readonly SyncInfo $syncInfo,
13 public readonly int $pointer,
14 public readonly bool $isLocked,
15 public readonly Status $status,
16 ) {}
17
18 public static function createFromRow(array $row): self
19 {
20 return new static(
21 (int)$row['ID'],
23 (int)$row['POINTER'],
24 $row['IS_LOCKED'] === 'Y',
25 Status::tryFrom($row['STATUS']) ?? Status::DEFAULT,
26 );
27 }
28
29 public function lock(): self
30 {
31 HrSyncQueueTable::update($this->id, ['IS_LOCKED' => true, 'DATE_UPDATE' => new DateTime()]);
32
33 return $this->copy(isLocked: true);
34 }
35
36 public function unlock(): self
37 {
38 HrSyncQueueTable::update($this->id, ['IS_LOCKED' => false, 'DATE_UPDATE' => new DateTime()]);
39
40 return $this->copy(isLocked: false);
41 }
42
43 public function setErrorStatus(): self
44 {
45 HrSyncQueueTable::update($this->id, ['STATUS' => Status::ERROR->value, 'DATE_UPDATE' => new DateTime()]);
46
47 return $this->copy(status: Status::ERROR);
48 }
49
50 public function updatePointer(int $pointer): self
51 {
52 HrSyncQueueTable::update($this->id, ['POINTER' => $pointer, 'STATUS' => Status::DEFAULT->value, 'DATE_UPDATE' => new DateTime()]);
53
54 return $this->copy(pointer: $pointer, status: Status::DEFAULT);
55 }
56
57 protected function copy(
58 ?int $id = null,
59 ?SyncInfo $syncInfo = null,
60 ?int $pointer = null,
61 ?bool $isLocked = null,
62 ?Status $status = null
63 ): self
64 {
65 return new static(
66 $id ?? $this->id,
67 $syncInfo ?? $this->syncInfo,
68 $pointer ?? $this->pointer,
69 $isLocked ?? $this->isLocked,
71 );
72 }
73}
__construct(public readonly int $id, public readonly SyncInfo $syncInfo, public readonly int $pointer, public readonly bool $isLocked, public readonly Status $status,)
Определения QueueItem.php:10
copy(?int $id=null, ?SyncInfo $syncInfo=null, ?int $pointer=null, ?bool $isLocked=null, ?Status $status=null)
Определения QueueItem.php:57
static update($primary, array $data)
Определения datamanager.php:1256
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$status
Определения session.php:10