@@ -76,6 +76,9 @@ |
||
76 | 76 | return $this->getPool()->add($product); |
77 | 77 | } |
78 | 78 | |
79 | + /** |
|
80 | + * @param string $route |
|
81 | + */ |
|
79 | 82 | protected function getMap($route, Product $product) |
80 | 83 | { |
81 | 84 | return $this->factoryMap($route, ['itemId' => $product->getId()]); |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | protected $entity = 'Product'; |
21 | 21 | |
22 | 22 | protected $maps = [ |
23 | - 'save' => ['POST', '/loads/products'], |
|
24 | - 'updateStatus' => ['PUT', '/sellerItems/{itemId}/status'], //Ativação/Desativação de produto no Marketplace |
|
25 | - 'updateStock' => ['PUT', '/sellerItems/{itemId}/stock'], //Atualização do estoque do item |
|
26 | - 'updatePrice' => ['PUT', '/sellerItems/{itemId}/prices'], //Atualização do preço do item |
|
27 | - 'findById' => ['GET', '/loads/products/{itemId}'], |
|
28 | - 'fetch' => ['GET', '/sellerItems?_offset={offset}&_limit={limit}&status={status}&createdAt={createdAt}'], |
|
23 | + 'save' => [ 'POST', '/loads/products' ], |
|
24 | + 'updateStatus' => [ 'PUT', '/sellerItems/{itemId}/status' ], //Ativação/Desativação de produto no Marketplace |
|
25 | + 'updateStock' => [ 'PUT', '/sellerItems/{itemId}/stock' ], //Atualização do estoque do item |
|
26 | + 'updatePrice' => [ 'PUT', '/sellerItems/{itemId}/prices' ], //Atualização do preço do item |
|
27 | + 'findById' => [ 'GET', '/loads/products/{itemId}' ], |
|
28 | + 'fetch' => [ 'GET', '/sellerItems?_offset={offset}&_limit={limit}&status={status}&createdAt={createdAt}' ], |
|
29 | 29 | ]; |
30 | 30 | |
31 | 31 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | parent::update($entity, $existent); |
37 | 37 | |
38 | - $updated = []; |
|
38 | + $updated = [ ]; |
|
39 | 39 | |
40 | 40 | foreach ([ |
41 | 41 | 'Stock', |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | $getter = 'get' . $key; |
46 | 46 | if ($this->attributesDiff($entity->$getter(), $existent->$getter())) { |
47 | 47 | $method = 'update' . $key; |
48 | - $updated[$key] = $this->$method($entity); |
|
48 | + $updated[ $key ] = $this->$method($entity); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - $atualizado = ! empty($updated); |
|
52 | + $atualizado = !empty($updated); |
|
53 | 53 | |
54 | 54 | $context = [ |
55 | 55 | 'id' => $entity->getId(), |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $existent = $product->getPrevious(); |
69 | 69 | |
70 | - $this->log('INFO', 'save', ['route' => $route, 'existent' => $existent]); |
|
70 | + $this->log('INFO', 'save', [ 'route' => $route, 'existent' => $existent ]); |
|
71 | 71 | |
72 | 72 | if ($existent) { |
73 | 73 | return $this->update($product, $existent); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | protected function getMap($route, Product $product) |
80 | 80 | { |
81 | - return $this->factoryMap($route, ['itemId' => $product->getId()]); |
|
81 | + return $this->factoryMap($route, [ 'itemId' => $product->getId() ]); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | protected function updatePrice(Product $product) |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function fetchPrepare($data) |
31 | 31 | { |
32 | - if ( ! empty($data)) { |
|
32 | + if (!empty($data)) { |
|
33 | 33 | return $this->factoryEntityCollection($data); |
34 | 34 | } |
35 | 35 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $data = parent::findById($itemId); |
48 | 48 | |
49 | - if ( ! empty($data)) { |
|
49 | + if (!empty($data)) { |
|
50 | 50 | return $this->factoryEntity($data->toArray()); |
51 | 51 | } |
52 | 52 | } |