Exemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!in_array($mode = $input->getOption('mode'), array('full', 'delta'))) {
         throw new \Exception('Unsupported aggregation mode ' . $mode);
     }
     // loop through all uuids
     foreach ($input->getArgument('uuid') as $uuid) {
         // loop through all aggregation levels
         foreach ($input->getOption('level') as $level) {
             if (!Util\Aggregation::isValidAggregationLevel($level)) {
                 throw new \Exception('Unsupported aggregation level ' . $level);
             }
             $msg = "Performing '" . $mode . "' aggregation";
             if ($uuid) {
                 $msg .= " for UUID " . $uuid;
             }
             echo $msg . " on '" . $level . "' level.\n";
             $rows = $this->aggregator->aggregate($uuid, $level, $mode, $input->getOption('period'));
             echo "Updated {$rows} rows.\n";
         }
     }
 }