46 ->setName(
'make:tablet')
47 ->setDescription(
'Make ORM tablet for table')
48 ->addArgument(
'table_name', InputArgument::REQUIRED,
'table name')
49 ->addArgument(
'module', InputArgument::OPTIONAL,
'module id')
50 ->addOption(
'namespace',
'ns', InputOption::VALUE_REQUIRED,
'custom namespace')
51 ->addOption(
'root',
null, InputOption::VALUE_REQUIRED,
'root folder for generate. Defaults server document root')
52 ->addOption(
'psr4',
null, InputOption::VALUE_NEGATABLE,
'generate file path in PSR4 / camelCase style, ex: `module/lib/My/ClassName.php`',
true)
53 ->addOption(
'show',
null, InputOption::VALUE_NONE,
'outputs to console, without saving it. It can be used to save to an arbitrary location when using the `>` operator.')
57 protected function execute(InputInterface $input, OutputInterface
$output): int
59 $tableName = $input->getArgument(
'table_name');
60 if (!is_string($tableName))
62 throw new InvalidArgumentException(
'Table name must be string');
66 tableName: $tableName,
67 namespace: $input->getOption(
'namespace'),
68 moduleId: $input->getArgument(
'module'),
69 rootFolder: $input->getOption(
'root'),
70 psr4: $input->getOption(
'psr4') ===
true,
73 if ($input->getOption(
'show') ===
true)
75 $output->write($this->service->generateContent($dto));
80 $this->service->generateFile($dto);