|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of gpupo/netshoes-sdk |
|
5
|
|
|
* Created by Gilmar Pupo <[email protected]> |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
* For more information, see <http://www.g1mr.com/>. |
|
9
|
|
|
*/ |
|
10
|
|
|
namespace Gpupo\NetshoesSdk\Console\Command; |
|
11
|
|
|
|
|
12
|
|
|
use Gpupo\NetshoesSdk\Console\Application; |
|
13
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
14
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
15
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
16
|
|
|
|
|
17
|
|
|
class ProductCommand |
|
18
|
|
|
{ |
|
19
|
|
|
public static function append(Application $app) |
|
20
|
|
|
{ |
|
21
|
|
|
$app->appendCommand('product:view', 'Consulta a situação de um produto') |
|
22
|
|
|
->addArgument('productId', InputArgument::REQUIRED, 'Product ID') |
|
23
|
|
|
->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
24
|
|
|
$list = $app->processInputParameters([], $input, $output); |
|
25
|
|
|
|
|
26
|
|
|
$p = $app->factorySdk($list)->factoryManager('product')->findById($input->getArgument('productId')); |
|
27
|
|
|
|
|
28
|
|
|
$app->displayTableResults($output, [[ |
|
29
|
|
|
'Id' => $p->getProductId(), |
|
30
|
|
|
'Brand' => $p->getBrand(), |
|
31
|
|
|
'Department' => $p->getDepartment(), |
|
32
|
|
|
'Product Type' => $p->getProductType(), |
|
33
|
|
|
]]); |
|
34
|
|
|
|
|
35
|
|
|
$output->writeln('<fg=yellow>Skus</>'); |
|
36
|
|
|
|
|
37
|
|
|
$app->displayTableResults($output, $p->getSkus()); |
|
38
|
|
|
|
|
39
|
|
|
}); |
|
40
|
|
|
|
|
41
|
|
|
return $app; |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|