- Модуль: bizproc
- Путь к файлу: ~/bitrix/modules/bizproc/lib/Debugger/Session/Manager.php
- Класс: BitrixBizprocDebuggerSessionManager
- Вызов: Manager::startSession
static function startSession(array $parameterDocumentType, int $mode, int $userId, int $categoryId = 0)
{
if (!Mode::isMode($mode))
{
return static::getResult(self::ERROR_INCORRECT_MODE);
}
[$module, $entity, $documentType] = CBPHelper::ParseDocumentId($parameterDocumentType);
$session = new Session();
$session
->setId(uniqid('', true))
->setModuleId($module)
->setEntity($entity)
->setDocumentType($documentType)
->setMode($mode)
->setStartedBy($userId)
//->setStartedDate(new BitrixMainTypeDateTime())
->setActive(true)
->setDocumentCategoryId($categoryId)
;
$activeSession = self::getActiveSession();
if ($activeSession)
{
return self::getResult(
self::ERROR_DEBUGGER_ALREADY_STARTED,
['session' => $activeSession]
);
}
self::clearStaticCache();
$result = $session->save();
if ($result->isSuccess())
{
/** @var Session $sessionFromResult */
$sessionFromResult = $result->getObject();
$sessionFromResult->fillWorkflowContexts();
$sessionFromResult->fillDocuments();
self::setActiveSession($sessionFromResult);
}
return $result;
}