CBPDocument::killWorkflow: Bitrix method

      
<?php 
//  CBPDocument :: killWorkflow()
//  /dist/bitrix/modules/bizproc/classes/general/document.php:464

    
public static function killWorkflow($workflowId$terminate true$documentId null)
    {
        
$errors = array();
        if (
$terminate)
            static::
TerminateWorkflow($workflowId$documentId$errors);

        if (!
$errors)
        {
            
WorkflowInstanceTable::delete($workflowId);
            
CBPTaskService::DeleteByWorkflow($workflowId);
            
CBPTrackingService::DeleteByWorkflow($workflowId);
            
CBPStateService::DeleteWorkflow($workflowId);
        }

        return 
$errors;
    }