• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/controller/debugger.php
  • Класс: BitrixBizprocControllerDebugger
  • Вызов: Debugger::loadRobotsByWorkflowIdAction
public function loadRobotsByWorkflowIdAction(string $sessionId, string $workflowId): ?array
{
	$userId = (int)$this->getCurrentUser()->getId();

	$session = BitrixBizprocDebuggerSessionManager::getSessionById($sessionId);
	if (!$session)
	{
		$this->addError(new Error(Loc::getMessage('BIZPROC_CONTROLLER_DEBUGGER_NO_SESSION')));

		return null;
	}

	if (!$session->canUserDebug($userId))
	{
		$this->addError(new Error(Loc::getMessage('BIZPROC_CONTROLLER_DEBUGGER_CAN_DEBUG_ERROR')));

		return null;
	}

	if (!$session->hasWorkflow($workflowId))
	{
		$this->addError(new Error(Loc::getMessage('BIZPROC_CONTROLLER_DEBUGGER_NO_WORKFLOW')));

		return null;
	}

	$robots = [];

	foreach ($session->getWorkflowContexts() as $context)
	{
		if ($context->getWorkflowId() !== $workflowId)
		{
			continue;
		}

		$templateShards = $context->fillTemplateShards();
		$robots = $templateShards ? $templateShards->getRobotData() : [];
		break;
	}

	return [
		'workflowRobots' => $robots
	];
}