@@ -22,7 +22,8 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @return Gpupo\Common\Entity\CollectionAbstract|null |
|
| 25 | + * @param \Gpupo\Common\Entity\Collection $data |
|
| 26 | + * @return \Gpupo\Common\Entity\Collection|null |
|
| 26 | 27 | */ |
| 27 | 28 | protected function fetchPrepare($data) |
| 28 | 29 | { |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | protected $entity = 'Product'; |
| 21 | 21 | |
| 22 | 22 | protected $maps = [ |
| 23 | - 'save' => ['POST', '/products'], |
|
| 24 | - 'findById' => ['GET', '/products/{itemId}'], |
|
| 25 | - 'patch' => ['PATCH', '/products/{itemId}'], |
|
| 26 | - 'update' => ['PUT', '/products/{itemId}'], |
|
| 27 | - 'fetch' => ['GET', '/products?page={offset}&size={limit}'], |
|
| 23 | + 'save' => [ 'POST', '/products' ], |
|
| 24 | + 'findById' => [ 'GET', '/products/{itemId}' ], |
|
| 25 | + 'patch' => [ 'PATCH', '/products/{itemId}' ], |
|
| 26 | + 'update' => [ 'PUT', '/products/{itemId}' ], |
|
| 27 | + 'fetch' => [ 'GET', '/products?page={offset}&size={limit}' ], |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | parent::update($entity, $existent); |
| 36 | 36 | |
| 37 | - $updated = []; |
|
| 37 | + $updated = [ ]; |
|
| 38 | 38 | |
| 39 | 39 | foreach ([ |
| 40 | 40 | 'Stock', |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | $getter = 'get' . $key; |
| 45 | 45 | if ($this->attributesDiff($entity->$getter(), $existent->$getter())) { |
| 46 | 46 | $method = 'update' . $key; |
| 47 | - $updated[$key] = $this->$method($entity); |
|
| 47 | + $updated[ $key ] = $this->$method($entity); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $atualizado = ! empty($updated); |
|
| 51 | + $atualizado = !empty($updated); |
|
| 52 | 52 | |
| 53 | 53 | $context = [ |
| 54 | 54 | 'id' => $entity->getId(), |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $existent = $product->getPrevious(); |
| 68 | 68 | |
| 69 | - $this->log('INFO', 'save', ['route' => $route, 'existent' => $existent]); |
|
| 69 | + $this->log('INFO', 'save', [ 'route' => $route, 'existent' => $existent ]); |
|
| 70 | 70 | |
| 71 | 71 | if ($existent) { |
| 72 | 72 | return $this->update($product, $existent); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | protected function getMap($route, Product $product) |
| 79 | 79 | { |
| 80 | - return $this->factoryMap($route, ['itemId' => $product->getId()]); |
|
| 80 | + return $this->factoryMap($route, [ 'itemId' => $product->getId() ]); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | protected function updatePrice(Product $product) |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | protected $entity = 'Templates'; |
| 21 | 21 | |
| 22 | 22 | protected $maps = [ |
| 23 | - 'brands' => ['GET', '/brands'], |
|
| 23 | + 'brands' => [ 'GET', '/brands' ], |
|
| 24 | 24 | ]; |
| 25 | 25 | |
| 26 | 26 | public function getBrands() |