|
14 | 14 | use Symfony\Component\Console\Input\InputOption; |
15 | 15 | use Symfony\Component\Console\Output\OutputInterface; |
16 | 16 | use UserFrosting\Sprinkle\Core\Bakery\Helper\ConfirmableTrait; |
| 17 | +use UserFrosting\Sprinkle\Core\Database\Migrator\Migrator; |
17 | 18 | use UserFrosting\System\Bakery\BaseCommand; |
18 | 19 |
|
19 | 20 | /** |
@@ -79,13 +80,13 @@ protected function execute(InputInterface $input, OutputInterface $output) |
79 | 80 | try { |
80 | 81 | $migrated = $migrator->run(['pretend' => $pretend, 'step' => $step]); |
81 | 82 | } catch (\Exception $e) { |
82 | | - $this->io->writeln($migrator->getNotes()); |
| 83 | + $this->displayNotes($migrator); |
83 | 84 | $this->io->error($e->getMessage()); |
84 | 85 | exit(1); |
85 | 86 | } |
86 | 87 |
|
87 | 88 | // Get notes and display them |
88 | | - $this->io->writeln($migrator->getNotes()); |
| 89 | + $this->displayNotes($migrator); |
89 | 90 |
|
90 | 91 | // If all went well, there's no fatal errors and we have migrated |
91 | 92 | // something, show some success |
@@ -128,4 +129,15 @@ protected function setupMigrator(InputInterface $input) |
128 | 129 |
|
129 | 130 | return $migrator; |
130 | 131 | } |
| 132 | + |
| 133 | + /** |
| 134 | + * Display migrator notes |
| 135 | + * @param Migrator $migrator |
| 136 | + */ |
| 137 | + protected function displayNotes(Migrator $migrator) |
| 138 | + { |
| 139 | + if (!empty($notes = $migrator->getNotes())) { |
| 140 | + $this->io->writeln($notes); |
| 141 | + } |
| 142 | + } |
131 | 143 | } |
0 commit comments