CBPAllStateService :: AddStateParameter: Bitrix method

      
<?php 
//  CBPAllStateService :: AddStateParameter()
//  /dist/bitrix/modules/bizproc/classes/general/stateservice.php:578

    
public function AddStateParameter($workflowId$arStateParameter)
    {
        global 
$DB;

        
$workflowId trim($workflowId);
        if (
strlen($workflowId) <= 0)
            throw new 
Exception("workflowId");

        
$dbResult $DB->Query(
            
"SELECT STATE_PARAMETERS ".
            
"FROM b_bp_workflow_state ".
            
"WHERE ID = '".$DB->ForSql($workflowId)."' "
        
);

        if (
$arResult $dbResult->Fetch())
        {
            
$stateParameters = array();
            if (
strlen($arResult["STATE_PARAMETERS"]) > 0)
                
$stateParameters unserialize($arResult["STATE_PARAMETERS"]);

            
$stateParameters[] = $arStateParameter;

            
$stateParameters serialize($stateParameters);

            
$DB->Query(
                
"UPDATE b_bp_workflow_state SET ".
                
"    STATE_PARAMETERS = ".(strlen($stateParameters) > "'".$DB->ForSql($stateParameters)."'" "NULL").", ".
                
"    MODIFIED = ".$DB->CurrentTimeFunction()." ".
                
"WHERE ID = '".$DB->ForSql($workflowId)."' "
            
);
        }
    }