WorkflowInstanceTable :: migrateDocumentType: Bitrix method

      
<?php 
//  Bitrix\Bizproc\Workflow\Entity\WorkflowInstanceTable :: migrateDocumentType()
//  /dist/bitrix/modules/bizproc/lib/workflow/entity/workflowinstance.php:154

    
public static function migrateDocumentType($paramOldType$paramNewType$workflowTemplateIds)
    {
        
$oldType = \CBPHelper::parseDocumentId($paramOldType);
        
$newType = \CBPHelper::parseDocumentId($paramNewType);

        
$connection Main\Application::getConnection();
        
$sqlHelper $connection->getSqlHelper();
        
$table $sqlHelper->forSql(static::getTableName());

        
$firstEntity $sqlHelper->forSql($oldType[1]);
        
$firstModule $sqlHelper->forSql($oldType[0]);

        
$secondEntity $sqlHelper->forSql($newType[1]);
        
$secondModule $sqlHelper->forSql($newType[0]);

        
$templates implode(","array_map('intval'$workflowTemplateIds));

        
$connection->queryExecute("UPDATE {$table} 
            SET 
                ENTITY = '
{$firstEntity}',
                MODULE_ID = '
{$firstModule}
            WHERE 
                ENTITY = '
{$secondEntity}
                AND MODULE_ID = '
{$secondModule}
                AND WORKFLOW_TEMPLATE_ID IN (
{$templates})
        "
);

        return 
true;
    }