public static function pauseExecutions($deliveryExecutions, $reason = null)
    {
        /** @var DeliveryExecutionStateService $deliveryExecutionStateService */
        $deliveryExecutionStateService = ServiceManager::getServiceManager()->get(DeliveryExecutionStateService::SERVICE_ID);

        $result = [ 'processed' => [], 'unprocessed' => [] ];
        foreach($deliveryExecutions as $deliveryExecution) {
            if (is_string($deliveryExecution)) {
                $deliveryExecution = self::getDeliveryExecutionById($deliveryExecution);
            }

            try {
                $isPaused = $deliveryExecutionStateService->pauseExecution($deliveryExecution, $reason);
                if ($isPaused) {
                    $result['processed'][$deliveryExecution->getIdentifier()] = true;
                } else {
                    $result['unprocessed'][$deliveryExecution->getIdentifier()] = self::createErrorMessage($deliveryExecution, __('paused'));
                }
            } catch (\Exception $exception) {
                $result['unprocessed'][$deliveryExecution->getIdentifier()] = $exception->getMessage();
            }
        }

        return $result;
    }
public static function pauseExecutions($deliveryExecutions, $reason = null)
    {
        /** @var DeliveryExecutionStateService $deliveryExecutionStateService */
        $deliveryExecutionStateService = ServiceManager::getServiceManager()->get(DeliveryExecutionStateService::SERVICE_ID);

        $result = [ 'processed' => [], 'unprocessed' => [] ];
        foreach($deliveryExecutions as $deliveryExecution) {
            if (is_string($deliveryExecution)) {
                $deliveryExecution = self::getDeliveryExecutionById($deliveryExecution);
            }

            try {
                $isPaused = $deliveryExecutionStateService->pauseExecution($deliveryExecution, $reason);
                if ($isPaused) {
                    $result['processed'][$deliveryExecution->getIdentifier()] = true;
                } else {
                    $result['unprocessed'][$deliveryExecution->getIdentifier()] = self::createErrorMessage($deliveryExecution, __('paused'));
                }
            } catch (\Exception $exception) {
                $result['unprocessed'][$deliveryExecution->getIdentifier()] = $exception->getMessage();
            }
        }

        return $result;
    }
public static function pauseExecutions ( $ deliveryExecutions , $ reason = null ) { /** @var DeliveryExecutionStateService $deliveryExecutionStateService */ $ deliveryExecutionStateService = ServiceManager :: getServiceManager ( ) -> get ( DeliveryExecutionStateService :: SERVICE_ID ) ; $ result = [ 'processed' => [ ] , 'unprocessed' => [ ] ] ; foreach ( $ deliveryExecutions as $ deliveryExecution ) { if ( is_string ( $ deliveryExecution ) ) { $ deliveryExecution = self :: getDeliveryExecutionById ( $ deliveryExecution ) ; } try { $ isPaused = $ deliveryExecutionStateService -> pauseExecution ( $ deliveryExecution , $ reason ) ; if ( $ isPaused ) { $ result [ 'processed' ] [ $ deliveryExecution -> getIdentifier ( ) ] = true ; } else { $ result [ 'unprocessed' ] [ $ deliveryExecution -> getIdentifier ( ) ] = self :: createErrorMessage ( $ deliveryExecution , __ ( 'paused' ) ) ; } } catch ( \ Exception $ exception ) { $ result [ 'unprocessed' ] [ $ deliveryExecution -> getIdentifier ( ) ] = $ exception -> getMessage ( ) ; } } return $ result ; }
Pauses a list of delivery executions

@param array $deliveryExecutions
@param array $reason
@return array
@throws \oat\oatbox\service\ServiceNotFoundException
Pauses a list of delivery executions