• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/onlyoffice/models/documentsession.php
  • Класс: BitrixDiskDocumentOnlyOfficeModelsDocumentSession
  • Вызов: DocumentSession::createEditSession
public function createEditSession(): ?self
{
	$currentEditSession = self::load([
		'OBJECT_ID' => $this->getObjectId(),
		'VERSION_ID' => $this->getVersionId(),
		'TYPE' => self::TYPE_EDIT,
		'STATUS' => self::STATUS_ACTIVE,
	]);

	if ($currentEditSession && $currentEditSession->belongsToUser($this->getUserId()))
	{
		return $currentEditSession;
	}

	if ($currentEditSession)
	{
		return $currentEditSession->forkForUser($this->getUserId(), $this->getContext());
	}

	if ($this->isSingleUsageOfExternalHash())
	{
		return $this->transformToEdit()? $this : null;
	}

	return self::add([
		'OBJECT_ID' => $this->getObjectId(),
		'USER_ID' => $this->getUserId(),
		'OWNER_ID' => $this->getUserId(),
		'IS_EXCLUSIVE' => $this->isExclusive(),
		'VERSION_ID' => $this->getVersionId(),
		'TYPE' => self::TYPE_EDIT,
		'CONTEXT' => $this->getContextRaw(),
	], $this->errorCollection);
}