Mercurial > packages > magicforger
comparison src/Generator/Requests/RequestGenerator.php @ 29:010ace248d14 codex
Added support for filters, not fully there with relations or anything like that but it's a start
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Mon, 09 Jun 2025 20:51:04 -0400 |
| parents | 827efbf4d73c |
| children | 21439512ba69 |
comparison
equal
deleted
inserted
replaced
| 28:f88d2d5dee30 | 29:010ace248d14 |
|---|---|
| 43 | 43 |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 | 46 |
| 47 if ($this->option('all')) { | 47 if ($this->option('all')) { |
| 48 $this->input->setOption('filter_request', true); | |
| 48 $this->input->setOption('store_request', true); | 49 $this->input->setOption('store_request', true); |
| 49 $this->input->setOption('update_request', true); | 50 $this->input->setOption('update_request', true); |
| 51 } | |
| 52 | |
| 53 if ($this->option('filter_request')) { | |
| 54 $this->createFilterRequest(); | |
| 50 } | 55 } |
| 51 | 56 |
| 52 if ($this->option('store_request')) { | 57 if ($this->option('store_request')) { |
| 53 $this->createStoreRequest(); | 58 $this->createStoreRequest(); |
| 54 } | 59 } |
| 63 */ | 68 */ |
| 64 protected function getOptions(): array | 69 protected function getOptions(): array |
| 65 { | 70 { |
| 66 return array_merge(parent::getOptions(), [ | 71 return array_merge(parent::getOptions(), [ |
| 67 ['all', 'a', InputOption::VALUE_NONE, 'Generate all request classes for the table.'], | 72 ['all', 'a', InputOption::VALUE_NONE, 'Generate all request classes for the table.'], |
| 73 ['filter_request', 'f', InputOption::VALUE_NONE, 'Generate filter request class for the table.'], | |
| 68 ['store_request', 's', InputOption::VALUE_NONE, 'Generate store request class for the table.'], | 74 ['store_request', 's', InputOption::VALUE_NONE, 'Generate store request class for the table.'], |
| 69 ['update_request', 'u', InputOption::VALUE_NONE, 'Generate update request class for the table.'], | 75 ['update_request', 'u', InputOption::VALUE_NONE, 'Generate update request class for the table.'], |
| 70 ]); | 76 ]); |
| 71 } | 77 } |
| 72 | 78 |
| 80 * | 86 * |
| 81 * @return string | 87 * @return string |
| 82 */ | 88 */ |
| 83 protected function getStub() {} | 89 protected function getStub() {} |
| 84 | 90 |
| 91 protected function createFilterRequest() | |
| 92 { | |
| 93 $this->call('mf:filter_request', ['table' => $this->getTableInput()]); | |
| 94 } | |
| 95 | |
| 85 protected function createStoreRequest() | 96 protected function createStoreRequest() |
| 86 { | 97 { |
| 87 $this->call('mf:store_request', ['table' => $this->getTableInput()]); | 98 $this->call('mf:store_request', ['table' => $this->getTableInput()]); |
| 88 } | 99 } |
| 89 | 100 |
