| @@ 69-86 (lines=18) @@ | ||
| 66 | }); |
|
| 67 | } |
|
| 68 | ||
| 69 | public function translateTo($app) |
|
| 70 | { |
|
| 71 | $this->getApp()->appendCommand('product:translate:to', 'Exporta o produto no padrão comum') |
|
| 72 | ->addArgument('productId', InputArgument::REQUIRED, 'Product ID') |
|
| 73 | ->addArgument('filenameOutput', InputArgument::REQUIRED, 'Caminho do arquivo que será gerado') |
|
| 74 | ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
| 75 | $list = $app->processInputParameters([], $input, $output); |
|
| 76 | $id = $input->getArgument('productId'); |
|
| 77 | $filenameOutput = $input->getArgument('filenameOutput'); |
|
| 78 | $p = $app->factorySdk($list)->factoryManager('product')->translatorFindById($id); |
|
| 79 | ||
| 80 | if (empty($p)) { |
|
| 81 | return $output->writeln('<error>Produto não encontrado!</error>'); |
|
| 82 | } |
|
| 83 | ||
| 84 | return $app->jsonSaveToFile($p->toArray(), $filenameOutput, $output); |
|
| 85 | }); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function translateUpdate($app) |
|
| 89 | { |
|
| @@ 122-139 (lines=18) @@ | ||
| 119 | }); |
|
| 120 | } |
|
| 121 | ||
| 122 | public function translateTo($app) |
|
| 123 | { |
|
| 124 | $this->getApp()->appendCommand('order:translate:to', 'Exporta o pedido no padrão comum') |
|
| 125 | ->addArgument('orderId', InputArgument::REQUIRED, 'Order ID') |
|
| 126 | ->addArgument('filenameOutput', InputArgument::REQUIRED, 'Caminho do arquivo que será gerado') |
|
| 127 | ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
| 128 | $list = $app->processInputParameters([], $input, $output); |
|
| 129 | $id = $input->getArgument('orderId'); |
|
| 130 | $filenameOutput = $input->getArgument('filenameOutput'); |
|
| 131 | $p = $app->factorySdk($list)->factoryManager('order')->translatorFindById($id); |
|
| 132 | ||
| 133 | if (empty($p)) { |
|
| 134 | return $output->writeln('<error>Pedido não encontrado!</error>'); |
|
| 135 | } |
|
| 136 | ||
| 137 | return $app->jsonSaveToFile($p->toArray(), $filenameOutput, $output); |
|
| 138 | }); |
|
| 139 | } |
|
| 140 | ||
| 141 | public function translateFrom($app) |
|
| 142 | { |
|