Esempio n. 1
0
 /**
  * Execute the Command
  *
  * @access protected
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $transactions = \Skeleton\Transaction\Transaction::get_runnable();
     $table = new Table($output);
     $table->setHeaders(['ID', 'Type', 'Scheduled at']);
     $rows = [];
     foreach ($transactions as $transaction) {
         $rows[] = [$transaction->id, $transaction->classname, $transaction->scheduled_at];
     }
     $table->setRows($rows);
     $table->render();
     return 0;
 }
Esempio n. 2
0
 /**
  * Execute the Command
  *
  * @access protected
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $transactions = [];
     if ($input->getArgument('id')) {
         $transactions[] = \Skeleton\Transaction\Transaction::get_by_id($input->getArgument('id'));
     } else {
         $transactions = \Skeleton\Transaction\Transaction::get_runnable();
     }
     foreach ($transactions as $transaction) {
         \Skeleton\Transaction\Runner::run_transaction($transaction);
         if ($transaction->failed) {
             $output->writeln($transaction->id . "\t" . $transaction->classname . "\t" . '<error>error</error>');
         } else {
             $output->writeln($transaction->id . "\t" . $transaction->classname . "\t" . '<info>done</info>');
         }
     }
     return 0;
 }