Mercurial > packages > magicforger
comparison src/Generator/Requests/RequestGenerator.php @ 23:827efbf4d73c main-dev
Huge changes to the relationships for models and more complex
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Fri, 11 Apr 2025 20:50:20 -0400 |
| parents | ee8ef14e158d |
| children | 010ace248d14 |
comparison
equal
deleted
inserted
replaced
| 22:ee8ef14e158d | 23:827efbf4d73c |
|---|---|
| 36 * Execute the console command. | 36 * Execute the console command. |
| 37 */ | 37 */ |
| 38 public function handle() | 38 public function handle() |
| 39 { | 39 { |
| 40 // First we need to ensure that the table exists, then we can | 40 // First we need to ensure that the table exists, then we can |
| 41 if (!$this->tableExists($this->getTableInput())) { | 41 if (! $this->tableExists($this->getTableInput())) { |
| 42 $this->components->error('The table: "'.$this->getTableInput().'" does not exist in the database.'); | 42 $this->components->error('The table: "'.$this->getTableInput().'" does not exist in the database.'); |
| 43 | 43 |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 | 46 |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Get the console command options. | 62 * Get the console command options. |
| 63 * | |
| 64 * @return array | |
| 65 */ | 63 */ |
| 66 protected function getOptions():array | 64 protected function getOptions(): array |
| 67 { | 65 { |
| 68 return array_merge(parent::getOptions(), [ | 66 return array_merge(parent::getOptions(), [ |
| 69 ['all', 'a', InputOption::VALUE_NONE, 'Generate all request classes for the table.'], | 67 ['all', 'a', InputOption::VALUE_NONE, 'Generate all request classes for the table.'], |
| 70 ['store_request', 's', InputOption::VALUE_NONE, 'Generate store request class for the table.'], | 68 ['store_request', 's', InputOption::VALUE_NONE, 'Generate store request class for the table.'], |
| 71 ['update_request', 'u', InputOption::VALUE_NONE, 'Generate update request class for the table.'], | 69 ['update_request', 'u', InputOption::VALUE_NONE, 'Generate update request class for the table.'], |
| 72 ]); | 70 ]); |
| 73 } | 71 } |
| 74 | 72 |
| 75 /** | 73 /** |
| 76 * Interact further with the user if they were prompted for missing arguments. | 74 * Interact further with the user if they were prompted for missing arguments. |
| 77 * | |
| 78 * @return void | |
| 79 */ | 75 */ |
| 80 protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output):void | 76 protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output): void {} |
| 81 { | |
| 82 } | |
| 83 | 77 |
| 84 /** | 78 /** |
| 85 * Get the stub file for the generator. | 79 * Get the stub file for the generator. |
| 86 * | 80 * |
| 87 * @return string | 81 * @return string |
| 88 */ | 82 */ |
| 89 protected function getStub() | 83 protected function getStub() {} |
| 90 { | |
| 91 } | |
| 92 | 84 |
| 93 protected function createStoreRequest() | 85 protected function createStoreRequest() |
| 94 { | 86 { |
| 95 $this->call('mf:store_request', ['table' => $this->getTableInput()]); | 87 $this->call('mf:store_request', ['table' => $this->getTableInput()]); |
| 96 } | 88 } |
