@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | #[ApiResource( |
29 | 29 | operations: [ |
30 | 30 | new Get(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
31 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product:write']]), |
|
31 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product:write' ] ]), |
|
32 | 32 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
33 | 33 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
34 | 34 | new GetCollection(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
35 | 35 | ], |
36 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
37 | - normalizationContext: ['max_depth' => 2, 'groups' => ['product:read']], |
|
38 | - denormalizationContext: ['groups' => ['product:write']] |
|
39 | -)] |
|
40 | -#[ApiFilter(OrderFilter::class, properties: ['id' => 'ASC', 'product' => 'ASC', 'price' => 'DESC'])] |
|
41 | -#[ApiFilter(RandomOrderFilter::class)] |
|
36 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
37 | + normalizationContext: [ 'max_depth' => 2, 'groups' => [ 'product:read' ] ], |
|
38 | + denormalizationContext: [ 'groups' => [ 'product:write' ] ] |
|
39 | +) ] |
|
40 | +#[ApiFilter(OrderFilter::class, properties: [ 'id' => 'ASC', 'product' => 'ASC', 'price' => 'DESC' ]) ] |
|
41 | +#[ApiFilter(RandomOrderFilter::class) ] |
|
42 | 42 | class Product |
43 | 43 | { |
44 | 44 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @ORM\GeneratedValue(strategy="IDENTITY") |
49 | 49 | * @Groups({"product_category:read","product:read","order_product:read"}) |
50 | 50 | */ |
51 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
51 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
52 | 52 | private $id; |
53 | 53 | |
54 | 54 | /** |
@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | * @ORM\Column(name="product", type="string", length=255, nullable=false) |
57 | 57 | * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
58 | 58 | */ |
59 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'partial'])] |
|
59 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'partial' ]) ] |
|
60 | 60 | private $product; |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @ORM\OneToMany(targetEntity="ProductFile", mappedBy="product") |
64 | 64 | * @Groups({"product:read","product_category:read","order_product:read"}) |
65 | 65 | */ |
66 | - #[ApiFilter(filterClass: ExistsFilter::class, properties: ['productFiles'])] |
|
67 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productFiles.file.fileType' => 'exact'])] |
|
66 | + #[ApiFilter(filterClass: ExistsFilter::class, properties: [ 'productFiles' ]) ] |
|
67 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productFiles.file.fileType' => 'exact' ]) ] |
|
68 | 68 | private $productFiles; |
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @ORM\OneToMany(targetEntity="ProductCategory", mappedBy="product") |
72 | 72 | */ |
73 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCategory.category' => 'exact'])] |
|
73 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCategory.category' => 'exact' ]) ] |
|
74 | 74 | private $productCategory; |
75 | 75 | |
76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @ORM\Column(name="sku", type="string", length=32, nullable=true, options={"default"="NULL"}) |
79 | 79 | * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
80 | 80 | */ |
81 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['sku' => 'partial'])] |
|
81 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'sku' => 'partial' ]) ] |
|
82 | 82 | private $sku = null; |
83 | 83 | |
84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @ORM\Column(name="type", type="string", length=0, nullable=false, options={"default"="'product'"}) |
87 | 87 | * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
88 | 88 | */ |
89 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])] |
|
89 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'type' => 'exact' ]) ] |
|
90 | 90 | private $type = 'product'; |
91 | 91 | |
92 | 92 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @ORM\Column(name="product_condition", type="string", length=0, nullable=false, options={"default"="'new'"}) |
102 | 102 | * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
103 | 103 | */ |
104 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCondition' => 'exact'])] |
|
104 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCondition' => 'exact' ]) ] |
|
105 | 105 | private $productCondition = 'new'; |
106 | 106 | |
107 | 107 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @ORM\Column(name="featured", type="boolean", nullable=false, options={"default"="0"}) |
117 | 117 | * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
118 | 118 | */ |
119 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['featured' => 'exact'])] |
|
119 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'featured' => 'exact' ]) ] |
|
120 | 120 | private $featured = false; |
121 | 121 | |
122 | 122 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @ORM\Column(name="active", type="boolean", nullable=false, options={"default"="1"}) |
125 | 125 | * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
126 | 126 | */ |
127 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['active' => 'exact'])] |
|
127 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'active' => 'exact' ]) ] |
|
128 | 128 | private $active = true; |
129 | 129 | |
130 | 130 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * }) |
136 | 136 | * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
137 | 137 | */ |
138 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])] |
|
138 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'company' => 'exact' ]) ] |
|
139 | 139 | private $company; |
140 | 140 | |
141 | 141 | /** |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | public function addProductGroupProduct(ProductGroupProduct $productGroupProduct): self |
323 | 323 | { |
324 | 324 | if (!$this->productGroupProducts->contains($productGroupProduct)) { |
325 | - $this->productGroupProducts[] = $productGroupProduct; |
|
325 | + $this->productGroupProducts[ ] = $productGroupProduct; |
|
326 | 326 | $productGroupProduct->setProduct($this); |
327 | 327 | } |
328 | 328 |