@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | protected $entity = 'Sku'; |
18 | 18 | |
19 | 19 | protected $maps = [ |
20 | - 'save' => ['POST', '/products/{productId}/skus'], //Create a new sku for a product |
|
21 | - 'findById' => ['GET', '/products/{productId}/skus/{itemId}'], // Get the a sku by product Id and sku Id |
|
22 | - 'update' => ['PUT', '/products/{productId}/skus/{sku}/{itemId}'], //Update a product based on SKU |
|
23 | - 'fetch' => ['GET', '/products/{productId}/skus?page={offset}&size={limit}'], //Get the list of product skus |
|
24 | - 'saveStatus' => ['PUT', '/skus/{sku}/bus/{buId}/status'], //Enable or disable sku for sale |
|
25 | - 'savePriceSchedule' => ['POST', '/skus/{sku}/priceSchedules'], //Save a price schedule |
|
26 | - 'savePrice' => ['PUT', '/skus/{sku}/prices'], //Save a base price |
|
27 | - 'saveStock' => ['PUT', '/skus/{sku}/stocks'], //Update stock quantity by sku |
|
20 | + 'save' => [ 'POST', '/products/{productId}/skus' ], //Create a new sku for a product |
|
21 | + 'findById' => [ 'GET', '/products/{productId}/skus/{itemId}' ], // Get the a sku by product Id and sku Id |
|
22 | + 'update' => [ 'PUT', '/products/{productId}/skus/{sku}/{itemId}' ], //Update a product based on SKU |
|
23 | + 'fetch' => [ 'GET', '/products/{productId}/skus?page={offset}&size={limit}' ], //Get the list of product skus |
|
24 | + 'saveStatus' => [ 'PUT', '/skus/{sku}/bus/{buId}/status' ], //Enable or disable sku for sale |
|
25 | + 'savePriceSchedule' => [ 'POST', '/skus/{sku}/priceSchedules' ], //Save a price schedule |
|
26 | + 'savePrice' => [ 'PUT', '/skus/{sku}/prices' ], //Save a base price |
|
27 | + 'saveStock' => [ 'PUT', '/skus/{sku}/stocks' ], //Update stock quantity by sku |
|
28 | 28 | ]; |
29 | 29 | |
30 | 30 | public function save(EntityInterface $product, $route = 'save') |
@@ -34,6 +34,6 @@ discard block |
||
34 | 34 | |
35 | 35 | protected function getMap($route, Product $product) |
36 | 36 | { |
37 | - return $this->factoryMap($route, ['itemId' => $product->getId()]); |
|
37 | + return $this->factoryMap($route, [ 'itemId' => $product->getId() ]); |
|
38 | 38 | } |
39 | 39 | } |
@@ -18,15 +18,15 @@ |
||
18 | 18 | public static function append(Application $app) |
19 | 19 | { |
20 | 20 | $insertOptions = [ |
21 | - ['key' => 'file'], |
|
21 | + [ 'key' => 'file' ], |
|
22 | 22 | ]; |
23 | 23 | |
24 | 24 | $app->appendCommand('product:sku:update', 'Atualiza um SKU') |
25 | 25 | ->setDefinition($app->factoryDefinition($insertOptions)) |
26 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app, $insertOptions) { |
|
26 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app, $insertOptions) { |
|
27 | 27 | $list = $app->processInputParameters($insertOptions, $input, $output); |
28 | 28 | |
29 | - $data = json_decode(file_get_contents($list['file']), true); |
|
29 | + $data = json_decode(file_get_contents($list[ 'file' ]), true); |
|
30 | 30 | $sdk = $app->factorySdk($list); |
31 | 31 | $product = $sdk->createSku($data); |
32 | 32 |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | { |
21 | 21 | $app->appendCommand('product:view', 'Consulta a situação de um produto') |
22 | 22 | ->addArgument('productId', InputArgument::REQUIRED, 'Product ID') |
23 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
24 | - $list = $app->processInputParameters([], $input, $output); |
|
23 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) { |
|
24 | + $list = $app->processInputParameters([ ], $input, $output); |
|
25 | 25 | |
26 | 26 | $p = $app->factorySdk($list)->factoryManager('product')->findById($input->getArgument('productId')); |
27 | 27 | |
28 | - $app->displayTableResults($output, [[ |
|
28 | + $app->displayTableResults($output, [ [ |
|
29 | 29 | 'Id' => $p->getProductId(), |
30 | 30 | 'Brand' => $p->getBrand(), |
31 | 31 | 'Department' => $p->getDepartment(), |
32 | 32 | 'Product Type' => $p->getProductType(), |
33 | - ]]); |
|
33 | + ] ]); |
|
34 | 34 | |
35 | 35 | $output->writeln('<fg=yellow>Skus</>'); |
36 | 36 | |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | }); |
40 | 40 | |
41 | 41 | $insertOptions = [ |
42 | - ['key' => 'file'], |
|
42 | + [ 'key' => 'file' ], |
|
43 | 43 | ]; |
44 | 44 | |
45 | 45 | $app->appendCommand('product:insert', 'Insere um produto a partir do Json de um arquivo') |
46 | 46 | ->setDefinition($app->factoryDefinition($insertOptions)) |
47 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app, $insertOptions) { |
|
47 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app, $insertOptions) { |
|
48 | 48 | $list = $app->processInputParameters($insertOptions, $input, $output); |
49 | 49 | |
50 | - $data = json_decode(file_get_contents($list['file']), true); |
|
50 | + $data = json_decode(file_get_contents($list[ 'file' ]), true); |
|
51 | 51 | $sdk = $app->factorySdk($list); |
52 | 52 | $product = $sdk->createProduct($data); |
53 | 53 |