Пример #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $date = $input->getOption('date');
     // run the migrations
     $start = microtime(true);
     try {
         if (null !== $date) {
             $this->manager->migrateToDateTime(new \DateTime($date));
         } else {
             $this->manager->migrate();
         }
     } catch (\Exception $e) {
         $output->writeln('<comment>Migration has been cancelled due to the following error:</comment>');
         $output->writeln('<comment>' . $e->getMessage() . '</comment>');
         return;
     }
     $end = microtime(true);
     $output->writeln('');
     $output->writeln('<comment>Migration completed. Total time: ' . sprintf('%.4fs', $end - $start) . '</comment>');
 }