| Total Complexity | 5 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class MigrationGeneratorCommand extends BaseCommand |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * The console command name. |
||
| 13 | * |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | protected $name = 'artomator:migration'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The console command description. |
||
| 20 | * |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $description = 'Create migration command'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Create a new command instance. |
||
| 27 | */ |
||
| 28 | public function __construct() |
||
| 29 | { |
||
| 30 | parent::__construct(); |
||
| 31 | |||
| 32 | $this->commandData = new CommandData($this, CommandData::$COMMAND_TYPE_API); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Execute the command. |
||
| 37 | * |
||
| 38 | * @return void |
||
| 39 | */ |
||
| 40 | public function handle() |
||
| 41 | { |
||
| 42 | parent::handle(); |
||
| 43 | |||
| 44 | if ($this->commandData->getOption('fromTable')) { |
||
| 45 | $this->error('fromTable option is not allowed to use with migration generator'); |
||
| 46 | |||
| 47 | return; |
||
| 48 | } |
||
| 49 | |||
| 50 | $migrationGenerator = new MigrationGenerator($this->commandData); |
||
| 51 | $migrationGenerator->generate(); |
||
| 52 | |||
| 53 | $this->performPostActionsWithMigration(); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Get the console command options. |
||
| 58 | * |
||
| 59 | * @return array |
||
| 60 | */ |
||
| 61 | public function getOptions() |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Get the console command arguments. |
||
| 68 | * |
||
| 69 | * @return array |
||
| 70 | */ |
||
| 71 | protected function getArguments() |
||
| 74 | } |
||
| 75 | } |
||
| 76 |