Example #1
0
 /**
  * @param MigrationsMigrateCommand $command
  */
 public function migrationsMigrate(MigrationsMigrateCommand $command)
 {
     try {
         $status = $this->migrator->status();
         $nextAvailableVersion = $status->nextAvailableVersion();
         if ($nextAvailableVersion !== null) {
             $command->getIo()->writeLine('Starting migration to version <c2>' . $nextAvailableVersion->__toString() . '</c2>');
             $this->migrator->migrate();
             $command->getIo()->writeLine('The migration has been <c1>successfully executed</c1>');
         } else {
             $command->getIo()->writeLine('<warn>There is no migration to execute.</warn>');
         }
     } catch (\Exception $e) {
         $command->getIo()->writeLine('<error>' . $e->getMessage() . '</error>');
     }
 }