diff src/Generator/Requests/RequestGenerator.php @ 34:f65ab84ee47f default

merge with codex
author luka
date Wed, 10 Sep 2025 21:00:47 -0400
parents 21439512ba69
children 2cf26b593f4a
line wrap: on
line diff
--- a/src/Generator/Requests/RequestGenerator.php	Sat Dec 02 10:20:32 2023 -0500
+++ b/src/Generator/Requests/RequestGenerator.php	Wed Sep 10 21:00:47 2025 -0400
@@ -1,12 +1,12 @@
 <?php
 
-namespace Wizzard\MagicForger\Generator\Requests;
+namespace Wizard\MagicForger\Generator\Requests;
 
 use Symfony\Component\Console\Attribute\AsCommand;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
-use Wizzard\MagicForger\Generator\BaseGenerator;
+use Wizard\MagicForger\Generator\BaseGenerator;
 
 #[AsCommand(name: 'mf:request')]
 class RequestGenerator extends BaseGenerator
@@ -38,17 +38,22 @@
     public function handle()
     {
         // First we need to ensure that the table exists, then we can
-        if (!$this->tableExists($this->getTableInput())) {
+        if (! $this->tableExists($this->getTableInput())) {
             $this->components->error('The table: "'.$this->getTableInput().'" does not exist in the database.');
 
             return false;
         }
 
         if ($this->option('all')) {
+            $this->input->setOption('filter_request', true);
             $this->input->setOption('store_request', true);
             $this->input->setOption('update_request', true);
         }
 
+        if ($this->option('filter_request')) {
+            $this->createFilterRequest();
+        }
+
         if ($this->option('store_request')) {
             $this->createStoreRequest();
         }
@@ -60,13 +65,12 @@
 
     /**
      * Get the console command options.
-     *
-     * @return array
      */
-    protected function getOptions()
+    protected function getOptions(): array
     {
         return array_merge(parent::getOptions(), [
             ['all', 'a', InputOption::VALUE_NONE, 'Generate all request classes for the table.'],
+            ['filter_request', 'i', InputOption::VALUE_NONE, 'Generate filter request class for the table.'],
             ['store_request', 's', InputOption::VALUE_NONE, 'Generate store request class for the table.'],
             ['update_request', 'u', InputOption::VALUE_NONE, 'Generate update request class for the table.'],
         ]);
@@ -74,20 +78,19 @@
 
     /**
      * Interact further with the user if they were prompted for missing arguments.
-     *
-     * @return void
      */
-    protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
-    {
-    }
+    protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output): void {}
 
     /**
      * Get the stub file for the generator.
      *
      * @return string
      */
-    protected function getStub()
+    protected function getStub() {}
+
+    protected function createFilterRequest()
     {
+        $this->call('mf:filter_request', ['table' => $this->getTableInput()]);
     }
 
     protected function createStoreRequest()