CBPWorkflow::start

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPWorkflow
  4. start
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/workflow.php
  • Класс: CBPWorkflow
  • Вызов: CBPWorkflow::start
public function start()
{
	if ($this->GetWorkflowStatus() != CBPWorkflowStatus::Created)
		throw new Exception("CanNotStartInstanceTwice");

	$this->isNew = true;
	$this->SetWorkflowStatus(CBPWorkflowStatus::Running);

	$this->rootActivity->setReadOnlyData(
		$this->rootActivity->pullProperties()
	);

	try
	{
		$this->InitializeActivity($this->rootActivity);
		$this->ExecuteActivity($this->rootActivity);
		$this->RunQueue();
	}
	catch (Exception $e)
	{
		$this->Terminate($e);
		throw $e;
	}

	if ($this->rootActivity->executionStatus == CBPActivityExecutionStatus::Closed)
	{
		$this->SetWorkflowStatus(CBPWorkflowStatus::Completed);
	}
	else
	{
		$workflowStatus = $this->GetWorkflowStatus();
		if ($workflowStatus == CBPWorkflowStatus::Running)
			$this->SetWorkflowStatus(CBPWorkflowStatus::Suspended);
	}

	$this->persister->SaveWorkflow($this->rootActivity, true);
}

Добавить комментарий