3namespace Bitrix\Im\V2\Recent\Initializer\Queue;
5use Bitrix\Im\Model\RecentInitQueueTable;
6use Bitrix\Im\V2\Recent\Initializer\SourceType;
7use Bitrix\Im\V2\Recent\Initializer\StageType;
8use Bitrix\Main\Type\DateTime;
13 public readonly
int $id,
15 public readonly StageType $stageType,
16 public readonly SourceType $sourceType,
17 public readonly ?
int $sourceId,
18 public readonly
string $pointer,
20 public readonly
bool $isLocked,
21 public readonly
DateTime $dateCreate,
22 public readonly
DateTime $dateUpdate,
23 public readonly
bool $isFirstInit
31 StageType::tryFrom($row[
'STAGE'] ??
null) ?? StageType::Target,
32 SourceType::tryFrom($row[
'SOURCE'] ??
null) ?? SourceType::Collab,
33 isset($row[
'SOURCE_ID']) ? (int)$row[
'SOURCE_ID'] :
null,
36 $row[
'IS_LOCKED'] ===
'Y',
43 public static function createFirstStep(
int $userId, SourceType $sourceType, ?
int $sourceId,
bool $isFirstInit =
false): static
50 StageType::getFirst(),
62 public function setId(
int $id): self
64 return $this->
copy(
id: $id);
67 public function lock(): self
71 return $this->
copy(isLocked:
true);
74 public function unlock(
bool $withSave =
false): self
81 return $this->
copy(isLocked:
false);
86 return $this->
copy(status:
'ERROR', dateUpdate:
new DateTime());
89 public function updatePointer(
string $pointer, ?StageType $stage =
null): self
91 return $this->
copy(stageType: $stage, pointer: $pointer, status:
'', dateUpdate:
new DateTime());
99 'STAGE' => $this->stageType->value,
100 'SOURCE' => $this->sourceType->value,
101 'SOURCE_ID' => $this->sourceId,
102 'POINTER' => $this->pointer,
104 'IS_LOCKED' => $this->isLocked,
105 'DATE_CREATE' => $this->dateCreate,
106 'DATE_UPDATE' => $this->dateUpdate,
113 ?StageType $stageType =
null,
114 ?SourceType $sourceType =
null,
115 ?
int $sourceId =
null,
116 ?
string $pointer =
null,
118 ?
bool $isLocked =
null,
121 ?
bool $isFirstInit =
null,
127 $stageType ?? $this->stageType,
128 $sourceType ?? $this->sourceType,
129 $sourceId ?? $this->sourceId,
130 $pointer ?? $this->pointer,
132 $isLocked ?? $this->isLocked,
133 $dateCreate ?? $this->dateCreate,
134 $dateUpdate ?? $this->dateUpdate,
135 $isFirstInit ?? $this->isFirstInit,
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
copy(?int $id=null, ?int $userId=null, ?StageType $stageType=null, ?SourceType $sourceType=null, ?int $sourceId=null, ?string $pointer=null, ?string $status=null, ?bool $isLocked=null, ?DateTime $dateCreate=null, ?DateTime $dateUpdate=null, ?bool $isFirstInit=null,)
static createFromRow(array $row)
unlock(bool $withSave=false)
__construct(public readonly int $id, public readonly int $userId, public readonly StageType $stageType, public readonly SourceType $sourceType, public readonly ?int $sourceId, public readonly string $pointer, public readonly string $status, public readonly bool $isLocked, public readonly DateTime $dateCreate, public readonly DateTime $dateUpdate, public readonly bool $isFirstInit)
static createFirstStep(int $userId, SourceType $sourceType, ?int $sourceId, bool $isFirstInit=false)
updatePointer(string $pointer, ?StageType $stage=null)
static update($primary, array $data)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)