コード例 #1
0
ファイル: ContextHelper.php プロジェクト: Maksold/platform
 /**
  * @param ContextInterface $firstContext
  * @param ContextInterface $context
  */
 public static function mergeContextCounters(ContextInterface $firstContext, ContextInterface $context)
 {
     $firstContext->incrementReadCount($context->getReadCount());
     $firstContext->incrementAddCount($context->getAddCount());
     $firstContext->incrementUpdateCount($context->getUpdateCount());
     $firstContext->incrementReplaceCount($context->getReplaceCount());
     $firstContext->incrementDeleteCount($context->getDeleteCount());
     $firstContext->incrementErrorEntriesCount($context->getErrorEntriesCount());
 }
コード例 #2
0
 /**
  * Fetch job execution result statistic from context
  *
  * @param ContextInterface $context
  *
  * @return array
  */
 private function fetchStatistic(ContextInterface $context = null)
 {
     $counts = array_fill_keys(['read', 'processed', 'updated', 'deleted', 'added', 'invalid'], 0);
     if ($context) {
         $counts['read'] = (int) $context->getReadCount();
         $counts['processed'] += $counts['added'] = (int) $context->getAddCount();
         $counts['processed'] += $counts['updated'] = (int) $context->getUpdateCount();
         $counts['processed'] += $counts['deleted'] = (int) $context->getDeleteCount();
         $counts['invalid'] = (int) $context->getErrorEntriesCount();
     }
     return $counts;
 }