• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/Debugger/Session/Session.php
  • Класс: BitrixBizprocDebuggerSessionSession
  • Вызов: Session::addWorkflowContext
public function addWorkflowContext(string $workflowId, $template): BitrixMainORMDataResult
{
	if ($this->hasWorkflow($workflowId))
	{
		$contextRow = DebuggerSessionWorkflowContextTable::getRow([
			'filter' => ['WORKFLOW_ID' => $workflowId],
		]);

		$context = DebuggerSessionWorkflowContextTable::wakeUpObject($contextRow);
	}
	else
	{
		$context = DebuggerSessionWorkflowContextTable::createObject();
		$context
			->setWorkflowId($workflowId)
			->setSessionId($this->getId())
		;
	}

	$context->addTemplateShards($template);
	$result = $context->save();

	if ($result->isSuccess())
	{
		$this->addToWorkflowContexts($context);
	}

	return $result;
}