@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | #[ApiResource( |
| 27 | 27 | operations: [ |
| 28 | 28 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
| 29 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_group:write']]), |
|
| 29 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_group:write' ] ]), |
|
| 30 | 30 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
| 31 | 31 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
| 32 | 32 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
| 33 | 33 | ], |
| 34 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
| 35 | - normalizationContext: ['groups' => ['product_group:read']], |
|
| 36 | - denormalizationContext: ['groups' => ['product_group:write']] |
|
| 37 | -)] |
|
| 34 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
| 35 | + normalizationContext: [ 'groups' => [ 'product_group:read' ] ], |
|
| 36 | + denormalizationContext: [ 'groups' => [ 'product_group:write' ] ] |
|
| 37 | +) ] |
|
| 38 | 38 | class ProductGroup |
| 39 | 39 | { |
| 40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @ORM\GeneratedValue(strategy="IDENTITY") |
| 46 | 46 | * @Groups({"product_group:read","product_group:write"}) |
| 47 | 47 | */ |
| 48 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
| 48 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
| 49 | 49 | private $id; |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @ORM\Column(name="product_group", type="string", length=255, nullable=false) |
| 55 | 55 | * @Groups({"product_group:read","product_group:write"}) |
| 56 | 56 | */ |
| 57 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
|
| 57 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ] |
|
| 58 | 58 | |
| 59 | 59 | private $productGroup; |
| 60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @ORM\Column(name="price_calculation", type="string", length=0, nullable=false, options={"default"="'sum'"}) |
| 65 | 65 | * @Groups({"product_group:read","product_group:write"}) |
| 66 | 66 | */ |
| 67 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['priceCalculation' => 'exact'])] |
|
| 67 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'priceCalculation' => 'exact' ]) ] |
|
| 68 | 68 | |
| 69 | 69 | private $priceCalculation = 'sum'; |
| 70 | 70 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @ORM\OneToMany(targetEntity="ProductGroupProduct", mappedBy="productGroup", orphanRemoval=true) |
| 116 | 116 | * @Groups({"product_group:write"}) |
| 117 | 117 | */ |
| 118 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['products.type' => 'exact'])] |
|
| 118 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'products.type' => 'exact' ]) ] |
|
| 119 | 119 | |
| 120 | 120 | private $products; |
| 121 | 121 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | public function addProduct(ProductGroupProduct $product): self |
| 280 | 280 | { |
| 281 | 281 | if (!$this->products->contains($product)) { |
| 282 | - $this->products[] = $product; |
|
| 282 | + $this->products[ ] = $product; |
|
| 283 | 283 | $product->setProductGroup($this); |
| 284 | 284 | } |
| 285 | 285 | |