Mercurial > packages > magicforger
diff src/Generator/BaseGenerator.php @ 5:b0b2e79ad8e6
Not exatly sure what was changed but commiting to it :)
| author | luka |
|---|---|
| date | Thu, 12 Oct 2023 19:41:04 -0400 |
| parents | a20439b1c9d3 |
| children | 769a17898cc0 |
line wrap: on
line diff
--- a/src/Generator/BaseGenerator.php Tue Jun 27 20:16:55 2023 -0400 +++ b/src/Generator/BaseGenerator.php Thu Oct 12 19:41:04 2023 -0400 @@ -11,27 +11,34 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Wizzard\MagicForger\Generator\Replacer; +use Wizzard\MagicForger\Replacer\Replacer; abstract class BaseGenerator extends GeneratorCommand { use Replacer; /** - * The console command description. + * The schema of the database. * * @var string */ protected $schema; /** - * The console command description. + * The tables available in the schema. * - * @var string + * @var array */ protected $tables; /** + * The current Table being used. + * + * @var table + */ + protected $currentTable; + + /** * Execute the console command. */ public function handle() @@ -159,6 +166,7 @@ return $this->files->get($this->getStub()); } + /** * Get the desired class table from the input. * @@ -209,4 +217,23 @@ return $this->schema; } + + protected function getTable(string $table_name) + { + return $this->getSchema()->introspectTable($table_name); + } + + protected function getCurrentTable() + { + return $this->currentTable; + } + + protected function setCurrentTable(string $table_name) + { + $table = null; + if(!is_null($table_name) && trim($table_name) !== '') { + $table = $this->getTable($table_name); + } + $this->currentTable = $table; + } }
