@@ -25,25 +25,25 @@ discard block |
||
25 | 25 | |
26 | 26 | ) {} |
27 | 27 | |
28 | - #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: ['GET'])] |
|
29 | - #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
28 | + #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: [ 'GET' ]) ] |
|
29 | + #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
30 | 30 | public function getPurchasingSuggestion(Request $request): JsonResponse |
31 | 31 | { |
32 | - $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
32 | + $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
33 | 33 | $data = $this->productService->getPurchasingSuggestion($company); |
34 | 34 | return new JsonResponse($data); |
35 | 35 | } |
36 | 36 | |
37 | - #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: ['POST'])] |
|
38 | - #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
37 | + #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: [ 'POST' ]) ] |
|
38 | + #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
39 | 39 | public function printPurchasingSuggestion(Request $request): JsonResponse |
40 | 40 | { |
41 | 41 | try { |
42 | 42 | $data = json_decode($request->getContent(), true); |
43 | 43 | $device = $this->manager->getRepository(Device::class)->findOneBy([ |
44 | - 'device' => $data['device'] |
|
44 | + 'device' => $data[ 'device' ] |
|
45 | 45 | ]); |
46 | - $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
46 | + $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
47 | 47 | $printData = $this->productService->purchasingSuggestionPrintData($company, $device); |
48 | 48 | |
49 | 49 | return new JsonResponse($this->hydratorService->item(Spool::class, $printData->getId(), "spool_item:read"), Response::HTTP_OK); |
@@ -52,27 +52,27 @@ discard block |
||
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - #[Route('/products/inventory', name: 'products_inventory', methods: ['GET'])] |
|
56 | - #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
55 | + #[Route('/products/inventory', name: 'products_inventory', methods: [ 'GET' ]) ] |
|
56 | + #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
57 | 57 | public function getProductsInventory(Request $request): JsonResponse |
58 | 58 | { |
59 | - $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
59 | + $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
60 | 60 | $data = $this->productService->getProductsInventory($company); |
61 | 61 | return new JsonResponse($data); |
62 | 62 | } |
63 | 63 | |
64 | - #[Route('/products/inventory/print', name: 'products_inventory_print', methods: ['POST'])] |
|
65 | - #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
64 | + #[Route('/products/inventory/print', name: 'products_inventory_print', methods: [ 'POST' ]) ] |
|
65 | + #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
66 | 66 | public function print(Request $request): JsonResponse |
67 | 67 | { |
68 | 68 | try { |
69 | 69 | $data = json_decode($request->getContent(), true); |
70 | 70 | error_log(json_encode($data)); |
71 | 71 | $device = $this->manager->getRepository(Device::class)->findOneBy([ |
72 | - 'device' => $data['device'] |
|
72 | + 'device' => $data[ 'device' ] |
|
73 | 73 | ]); |
74 | 74 | |
75 | - $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
75 | + $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
76 | 76 | $printData = $this->productService->productsInventoryPrintData($company, $device); |
77 | 77 | return new JsonResponse($this->hydratorService->item(Spool::class, $printData->getId(), "spool_item:read"), Response::HTTP_OK); |
78 | 78 | } catch (Exception $e) { |
@@ -20,38 +20,38 @@ |
||
20 | 20 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
21 | 21 | new Put( |
22 | 22 | security: 'is_granted(\'ROLE_CLIENT\')', |
23 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
23 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
24 | 24 | ), |
25 | 25 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
26 | 26 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
27 | 27 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
28 | 28 | ], |
29 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
30 | - normalizationContext: ['groups' => ['product_file:read']], |
|
31 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
32 | -)] |
|
33 | -#[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact'])] |
|
34 | -#[ORM\Table(name: 'product_file')] |
|
35 | -#[ORM\Index(name: 'file_id', columns: ['file_id'])] |
|
36 | -#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: ['product_id'])] |
|
37 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'file_id'])] |
|
38 | -#[ORM\Entity(repositoryClass: ProductFileRepository::class)] |
|
29 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
30 | + normalizationContext: [ 'groups' => [ 'product_file:read' ] ], |
|
31 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
32 | +) ] |
|
33 | +#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact' ]) ] |
|
34 | +#[ORM\Table(name: 'product_file') ] |
|
35 | +#[ORM\Index(name: 'file_id', columns: [ 'file_id' ]) ] |
|
36 | +#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: [ 'product_id' ]) ] |
|
37 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'file_id' ]) ] |
|
38 | +#[ORM\Entity(repositoryClass: ProductFileRepository::class) ] |
|
39 | 39 | class ProductFile |
40 | 40 | { |
41 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
42 | - #[ORM\Id] |
|
43 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
44 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_category:read'])] |
|
41 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
42 | + #[ORM\Id ] |
|
43 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
44 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_category:read' ]) ] |
|
45 | 45 | private int $id = 0; |
46 | 46 | |
47 | - #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id')] |
|
48 | - #[ORM\ManyToOne(targetEntity: File::class)] |
|
49 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read'])] |
|
47 | + #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id') ] |
|
48 | + #[ORM\ManyToOne(targetEntity: File::class) ] |
|
49 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read' ]) ] |
|
50 | 50 | private File $file; |
51 | 51 | |
52 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
53 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
54 | - #[Groups(['product_file:read', 'product_file:write'])] |
|
52 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
53 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
54 | + #[Groups([ 'product_file:read', 'product_file:write' ]) ] |
|
55 | 55 | private Product $product; |
56 | 56 | |
57 | 57 | public function getId(): int |
@@ -21,39 +21,39 @@ |
||
21 | 21 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
22 | 22 | new Put( |
23 | 23 | security: 'is_granted(\'ROLE_CLIENT\')', |
24 | - denormalizationContext: ['groups' => ['product_category:write']] |
|
24 | + denormalizationContext: [ 'groups' => [ 'product_category:write' ] ] |
|
25 | 25 | ), |
26 | 26 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
27 | 27 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
28 | 28 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
29 | 29 | ], |
30 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
31 | - normalizationContext: ['groups' => ['product_category:read']], |
|
32 | - denormalizationContext: ['groups' => ['product_category:write']] |
|
33 | -)] |
|
34 | -#[ApiFilter(OrderFilter::class, properties: ['product.product'])] |
|
35 | -#[ApiFilter(filterClass: SearchFilter::class, properties: ['category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact'])] |
|
36 | -#[ORM\Table(name: 'product_category')] |
|
37 | -#[ORM\Index(name: 'category_id', columns: ['category_id'])] |
|
38 | -#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: ['product_id'])] |
|
39 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'category_id'])] |
|
40 | -#[ORM\Entity(repositoryClass: ProductCategoryRepository::class)] |
|
30 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
31 | + normalizationContext: [ 'groups' => [ 'product_category:read' ] ], |
|
32 | + denormalizationContext: [ 'groups' => [ 'product_category:write' ] ] |
|
33 | +) ] |
|
34 | +#[ApiFilter(OrderFilter::class, properties: [ 'product.product' ]) ] |
|
35 | +#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact' ]) ] |
|
36 | +#[ORM\Table(name: 'product_category') ] |
|
37 | +#[ORM\Index(name: 'category_id', columns: [ 'category_id' ]) ] |
|
38 | +#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: [ 'product_id' ]) ] |
|
39 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'category_id' ]) ] |
|
40 | +#[ORM\Entity(repositoryClass: ProductCategoryRepository::class) ] |
|
41 | 41 | class ProductCategory |
42 | 42 | { |
43 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
44 | - #[ORM\Id] |
|
45 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
46 | - #[Groups(['product_category:read'])] |
|
43 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
44 | + #[ORM\Id ] |
|
45 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
46 | + #[Groups([ 'product_category:read' ]) ] |
|
47 | 47 | private int $id = 0; |
48 | 48 | |
49 | - #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')] |
|
50 | - #[ORM\ManyToOne(targetEntity: Category::class)] |
|
51 | - #[Groups(['product_category:read', 'product_category:write'])] |
|
49 | + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id') ] |
|
50 | + #[ORM\ManyToOne(targetEntity: Category::class) ] |
|
51 | + #[Groups([ 'product_category:read', 'product_category:write' ]) ] |
|
52 | 52 | private Category $category; |
53 | 53 | |
54 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
55 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
56 | - #[Groups(['product_category:read', 'product_category:write'])] |
|
54 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
55 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
56 | + #[Groups([ 'product_category:read', 'product_category:write' ]) ] |
|
57 | 57 | private Product $product; |
58 | 58 | |
59 | 59 | public function getId(): int |