setName('table:create') // 运行 "php console_command list" 时的简短描述 ->setDescription('Create new model') // 运行命令时使用 "--help" 选项时的完整命令描述 ->setHelp('This command allow you to create models...') // 配置一个参数m ->addArgument('name', InputArgument::REQUIRED, 'what\'s model you want to create ?') // 配置一个可选参数 ->addArgument('optional_argument', InputArgument::OPTIONAL, 'this is a optional argument'); } protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name'); if($name == 'wms'){ $allTables = $this->getDbTables(); $this->hf_mes_customer($allTables); $this->hf_mes_wms_material($allTables); $this->hf_mes_wms_material_barcode($allTables); $this->hf_mes_wms_storage_area_category($allTables); $this->hf_mes_wms_storage_area($allTables); $this->hf_mes_wms_storage_location($allTables); } $output->writeln('created ' . $input->getArgument('name') . ' table success !'); return 1; } /** * 获取数据库表名 * @return array */ private function getDbTables(): array { $sql = <<