@@ -29,15 +29,15 @@ |
||
29 | 29 | #[ApiResource( |
30 | 30 | operations: [ |
31 | 31 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
32 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_unity_edit']]), |
|
32 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_unity_edit' ] ]), |
|
33 | 33 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
34 | 34 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
35 | 35 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
36 | 36 | ], |
37 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
38 | - normalizationContext: ['groups' => ['product_unity_read']], |
|
39 | - denormalizationContext: ['groups' => ['product_unity_write']] |
|
40 | -)] |
|
37 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
38 | + normalizationContext: [ 'groups' => [ 'product_unity_read' ] ], |
|
39 | + denormalizationContext: [ 'groups' => [ 'product_unity_write' ] ] |
|
40 | +) ] |
|
41 | 41 | class ProductUnity |
42 | 42 | { |
43 | 43 | /** |
@@ -47,7 +47,6 @@ discard block |
||
47 | 47 | * @ORM\Id |
48 | 48 | * @ORM\GeneratedValue(strategy="IDENTITY") |
49 | 49 | * @Groups({"pruduct_read","product_unity_read"}) |
50 | - |
|
51 | 50 | */ |
52 | 51 | private $id; |
53 | 52 | |
@@ -56,7 +55,6 @@ discard block |
||
56 | 55 | * |
57 | 56 | * @ORM\Column(name="product_unit", type="string", length=3, nullable=false) |
58 | 57 | * @Groups({"pruduct_read","product_unity_read"}) |
59 | - |
|
60 | 58 | */ |
61 | 59 | private $productUnit; |
62 | 60 |
@@ -52,7 +52,6 @@ discard block |
||
52 | 52 | * @ORM\Id |
53 | 53 | * @ORM\GeneratedValue(strategy="IDENTITY") |
54 | 54 | * @Groups({"pruduct_read"}) |
55 | - |
|
56 | 55 | */ |
57 | 56 | private $id; |
58 | 57 | |
@@ -61,7 +60,6 @@ discard block |
||
61 | 60 | * |
62 | 61 | * @ORM\Column(name="product", type="string", length=255, nullable=false) |
63 | 62 | * @Groups({"pruduct_read","product_write"}) |
64 | - |
|
65 | 63 | */ |
66 | 64 | private $product; |
67 | 65 | |
@@ -70,7 +68,6 @@ discard block |
||
70 | 68 | * |
71 | 69 | * @ORM\Column(name="sku", type="string", length=32, nullable=true, options={"default"="NULL"}) |
72 | 70 | * @Groups({"pruduct_read","product_write"}) |
73 | - |
|
74 | 71 | */ |
75 | 72 | private $sku = NULL; |
76 | 73 | |
@@ -79,7 +76,6 @@ discard block |
||
79 | 76 | * |
80 | 77 | * @ORM\Column(name="type", type="string", length=0, nullable=false, options={"default"="'product'"}) |
81 | 78 | * @Groups({"pruduct_read","product_write"}) |
82 | - |
|
83 | 79 | */ |
84 | 80 | private $type = 'product'; |
85 | 81 | |
@@ -88,7 +84,6 @@ discard block |
||
88 | 84 | * |
89 | 85 | * @ORM\Column(name="price", type="float", precision=10, scale=0, nullable=false) |
90 | 86 | * @Groups({"pruduct_read","product_write"}) |
91 | - |
|
92 | 87 | */ |
93 | 88 | private $price = 0; |
94 | 89 | |
@@ -97,7 +92,6 @@ discard block |
||
97 | 92 | * |
98 | 93 | * @ORM\Column(name="product_condition", type="string", length=0, nullable=false, options={"default"="'new'"}) |
99 | 94 | * @Groups({"pruduct_read","product_write"}) |
100 | - |
|
101 | 95 | */ |
102 | 96 | private $productCondition = 'new'; |
103 | 97 | |
@@ -107,7 +101,6 @@ discard block |
||
107 | 101 | * |
108 | 102 | * @ORM\Column(name="description", type="string", length=0, nullable=false) |
109 | 103 | * @Groups({"pruduct_read","product_write"}) |
110 | - |
|
111 | 104 | */ |
112 | 105 | private $description = ''; |
113 | 106 | |
@@ -116,7 +109,6 @@ discard block |
||
116 | 109 | * |
117 | 110 | * @ORM\Column(name="active", type="boolean", nullable=false, options={"default"="1"}) |
118 | 111 | * @Groups({"pruduct_read","product_write"}) |
119 | - |
|
120 | 112 | */ |
121 | 113 | private $active = true; |
122 | 114 | |
@@ -128,7 +120,6 @@ discard block |
||
128 | 120 | * @ORM\JoinColumn(name="company_id", referencedColumnName="id") |
129 | 121 | * }) |
130 | 122 | * @Groups({"pruduct_read","product_write"}) |
131 | - |
|
132 | 123 | */ |
133 | 124 | private $company; |
134 | 125 |
@@ -32,15 +32,15 @@ |
||
32 | 32 | #[ApiResource( |
33 | 33 | operations: [ |
34 | 34 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
35 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_write']]), |
|
35 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_write' ] ]), |
|
36 | 36 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
37 | 37 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
38 | 38 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
39 | 39 | ], |
40 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
41 | - normalizationContext: ['groups' => ['pruduct_read']], |
|
42 | - denormalizationContext: ['groups' => ['product_write']] |
|
43 | -)] |
|
40 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
41 | + normalizationContext: [ 'groups' => [ 'pruduct_read' ] ], |
|
42 | + denormalizationContext: [ 'groups' => [ 'product_write' ] ] |
|
43 | +) ] |
|
44 | 44 | |
45 | 45 | |
46 | 46 | class Product |