| @@ 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 | { |
|
| @@ 112-129 (lines=18) @@ | ||
| 109 | }); |
|
| 110 | } |
|
| 111 | ||
| 112 | public function translateTo($app) |
|
| 113 | { |
|
| 114 | $this->getApp()->appendCommand('order:translate:to', 'Exporta o pedido no padrão comum') |
|
| 115 | ->addArgument('orderId', InputArgument::REQUIRED, 'Order ID') |
|
| 116 | ->addArgument('filenameOutput', InputArgument::REQUIRED, 'Caminho do arquivo que será gerado') |
|
| 117 | ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
| 118 | $list = $app->processInputParameters([], $input, $output); |
|
| 119 | $id = $input->getArgument('orderId'); |
|
| 120 | $filenameOutput = $input->getArgument('filenameOutput'); |
|
| 121 | $p = $app->factorySdk($list)->factoryManager('order')->translatorFindById($id); |
|
| 122 | ||
| 123 | if (empty($p)) { |
|
| 124 | return $output->writeln('<error>Pedido não encontrado!</error>'); |
|
| 125 | } |
|
| 126 | ||
| 127 | return $app->jsonSaveToFile($p->toArray(), $filenameOutput, $output); |
|
| 128 | }); |
|
| 129 | } |
|
| 130 | ||
| 131 | public function translateFrom($app) |
|
| 132 | { |
|