RestService :: getWorkflowInstances: Bitrix method

      
<?php 
//  Bitrix\Bizproc\RestService :: getWorkflowInstances()
//  /dist/bitrix/modules/bizproc/lib/restservice.php:562

    
public static function getWorkflowInstances($params$n$server)
    {
        
self::checkAdminPermissions();
        
$params array_change_key_case($paramsCASE_UPPER);

        
$fields = array(
            
'ID' => 'ID',
            
'MODIFIED' => 'MODIFIED',
            
'OWNED_UNTIL' => 'OWNED_UNTIL',
            
'MODULE_ID' => 'MODULE_ID',
            
'ENTITY' => 'ENTITY',
            
'DOCUMENT_ID' => 'DOCUMENT_ID',
            
'STARTED' => 'STARTED',
            
'STARTED_BY' => 'STARTED_BY',
            
'TEMPLATE_ID' => 'WORKFLOW_TEMPLATE_ID',
        );

        
$select = static::getSelect($params['SELECT'], $fields, array('ID''MODIFIED''OWNED_UNTIL'));
        
$filter = static::getFilter($params['FILTER'], $fields, array('MODIFIED''OWNED_UNTIL'));
        
$order = static::getOrder($params['ORDER'], $fields, array('MODIFIED' => 'DESC'));

        
$iterator WorkflowInstanceTable::getList(array(
            
'select' => $select,
            
'filter' => $filter,
            
'order' => $order,
            
'limit' => static::LIST_LIMIT,
            
'offset' => (int) $n,
            
'count_total' => true,
        ));

        
$result = array();
        while (
$row $iterator->fetch())
        {
            if (isset(
$row['MODIFIED']))
                
$row['MODIFIED'] = \CRestUtil::convertDateTime($row['MODIFIED']);
            if (isset(
$row['STARTED']))
                
$row['STARTED'] = \CRestUtil::convertDateTime($row['STARTED']);
            if (isset(
$row['OWNED_UNTIL']))
                
$row['OWNED_UNTIL'] = \CRestUtil::convertDateTime($row['OWNED_UNTIL']);
            
$result[] = $row;
        }

        return static::
setNavData($result, ['count' => $iterator->getCount(), 'offset' => $n]);
    }