@@ -18,7 +18,7 @@ |
||
18 | 18 | RequestStack $requestStack |
19 | 19 | |
20 | 20 | ) { |
21 | - $this->request = $requestStack->getCurrentRequest(); |
|
21 | + $this->request = $requestStack->getCurrentRequest(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 |
@@ -101,8 +101,9 @@ |
||
101 | 101 | $this->peopleService->getMyCompanies() |
102 | 102 | ); |
103 | 103 | |
104 | - if ($company) |
|
105 | - $qb->andWhere('pe = :company')->setParameter('company', $company); |
|
104 | + if ($company) { |
|
105 | + $qb->andWhere('pe = :company')->setParameter('company', $company); |
|
106 | + } |
|
106 | 107 | |
107 | 108 | error_log($qb->getQuery()->getSQL()); |
108 | 109 | return $qb->getQuery()->getResult(); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class ProductRepository extends ServiceEntityRepository |
20 | 20 | { |
21 | 21 | |
22 | - private $inventory_exclude_types = ['custom', 'component', 'manufactured']; |
|
22 | + private $inventory_exclude_types = [ 'custom', 'component', 'manufactured' ]; |
|
23 | 23 | |
24 | 24 | public function __construct( |
25 | 25 | private PeopleService $peopleService, |
@@ -32,31 +32,31 @@ discard block |
||
32 | 32 | { |
33 | 33 | $products = $this->getProductsInventory($provider); |
34 | 34 | |
35 | - $groupedByInventory = []; |
|
35 | + $groupedByInventory = [ ]; |
|
36 | 36 | foreach ($products as $product) { |
37 | - $inventoryName = $product['inventory_name']; |
|
38 | - if (!isset($groupedByInventory[$inventoryName])) { |
|
39 | - $groupedByInventory[$inventoryName] = []; |
|
37 | + $inventoryName = $product[ 'inventory_name' ]; |
|
38 | + if (!isset($groupedByInventory[ $inventoryName ])) { |
|
39 | + $groupedByInventory[ $inventoryName ] = [ ]; |
|
40 | 40 | } |
41 | - $groupedByInventory[$inventoryName][] = $product; |
|
41 | + $groupedByInventory[ $inventoryName ][ ] = $product; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | foreach ($groupedByInventory as $inventoryName => $items) { |
45 | - $companyName = $items[0]['company_name'] ; |
|
45 | + $companyName = $items[ 0 ][ 'company_name' ]; |
|
46 | 46 | $this->printService->addLine("", "", "-"); |
47 | 47 | $this->printService->addLine($companyName, "", " "); |
48 | - $this->printService->addLine("INVENTARIO: " . $inventoryName, "", " "); |
|
48 | + $this->printService->addLine("INVENTARIO: ".$inventoryName, "", " "); |
|
49 | 49 | $this->printService->addLine("", "", "-"); |
50 | 50 | $this->printService->addLine("Produto", "Disponivel", " "); |
51 | 51 | $this->printService->addLine("", "", "-"); |
52 | 52 | |
53 | 53 | foreach ($items as $item) { |
54 | - $productName = substr($item['product_name'], 0, 20); |
|
55 | - if (!empty($item['description'])) { |
|
56 | - $productName .= " " . substr($item['description'], 0, 10); |
|
54 | + $productName = substr($item[ 'product_name' ], 0, 20); |
|
55 | + if (!empty($item[ 'description' ])) { |
|
56 | + $productName .= " ".substr($item[ 'description' ], 0, 10); |
|
57 | 57 | } |
58 | - $productName .= " (" . $item['productUnit'] . ")"; |
|
59 | - $available = str_pad($item['available'], 4, " ", STR_PAD_LEFT); |
|
58 | + $productName .= " (".$item[ 'productUnit' ].")"; |
|
59 | + $available = str_pad($item[ 'available' ], 4, " ", STR_PAD_LEFT); |
|
60 | 60 | $this->printService->addLine($productName, $available, " "); |
61 | 61 | } |
62 | 62 | |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | { |
76 | 76 | $products = $this->getPurchasingSuggestion($provider); |
77 | 77 | |
78 | - $groupedByCompany = []; |
|
78 | + $groupedByCompany = [ ]; |
|
79 | 79 | foreach ($products as $product) { |
80 | - $companyName = $product['company_name'] ; |
|
81 | - if (!isset($groupedByCompany[$companyName])) { |
|
82 | - $groupedByCompany[$companyName] = []; |
|
80 | + $companyName = $product[ 'company_name' ]; |
|
81 | + if (!isset($groupedByCompany[ $companyName ])) { |
|
82 | + $groupedByCompany[ $companyName ] = [ ]; |
|
83 | 83 | } |
84 | - $groupedByCompany[$companyName][] = $product; |
|
84 | + $groupedByCompany[ $companyName ][ ] = $product; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $this->printService->addLine("", "", "-"); |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | $this->printService->addLine("", "", "-"); |
96 | 96 | |
97 | 97 | foreach ($items as $item) { |
98 | - $productName = substr($item['product_name'], 0, 20); |
|
99 | - if (!empty($item['description'])) { |
|
100 | - $productName .= " " . substr($item['description'], 0, 10); |
|
98 | + $productName = substr($item[ 'product_name' ], 0, 20); |
|
99 | + if (!empty($item[ 'description' ])) { |
|
100 | + $productName .= " ".substr($item[ 'description' ], 0, 10); |
|
101 | 101 | } |
102 | - if (!empty($item['unity'])) { |
|
103 | - $productName .= " (" . $item['unity'] . ")"; |
|
102 | + if (!empty($item[ 'unity' ])) { |
|
103 | + $productName .= " (".$item[ 'unity' ].")"; |
|
104 | 104 | } |
105 | - $needed = str_pad($item['needed'], 4, " ", STR_PAD_LEFT); |
|
105 | + $needed = str_pad($item[ 'needed' ], 4, " ", STR_PAD_LEFT); |
|
106 | 106 | $this->printService->addLine($productName, $needed, " "); |
107 | 107 | } |
108 | 108 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function getPurchasingSuggestion(Request $request): JsonResponse |
27 | 27 | { |
28 | - $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
28 | + $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
29 | 29 | $data = $this->productService->getPurchasingSuggestion($company); |
30 | 30 | return new JsonResponse($data); |
31 | 31 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | public function printPurchasingSuggestion(Request $request): JsonResponse |
38 | 38 | { |
39 | 39 | $data = json_decode($request->getContent(), true); |
40 | - $printType = $data['print-type']; |
|
41 | - $deviceType = $data['device-type']; |
|
42 | - $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
40 | + $printType = $data[ 'print-type' ]; |
|
41 | + $deviceType = $data[ 'device-type' ]; |
|
42 | + $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
43 | 43 | $printData = $this->productService->purchasingSuggestionPrintData($company, $printType, $deviceType); |
44 | 44 | return new JsonResponse($printData); |
45 | 45 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getProductsInventory(Request $request): JsonResponse |
54 | 54 | { |
55 | - $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
55 | + $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
56 | 56 | $data = $this->productService->getProductsInventory($company); |
57 | 57 | return new JsonResponse($data); |
58 | 58 | } |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | public function print(Request $request): JsonResponse |
64 | 64 | { |
65 | 65 | $data = json_decode($request->getContent(), true); |
66 | - $printType = $data['print-type']; |
|
67 | - $deviceType = $data['device-type']; |
|
68 | - $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
66 | + $printType = $data[ 'print-type' ]; |
|
67 | + $deviceType = $data[ 'device-type' ]; |
|
68 | + $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
69 | 69 | $printData = $this->productService->productsInventoryPrintData($company, $printType, $deviceType); |
70 | 70 | return new JsonResponse($printData); |
71 | 71 | } |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
24 | 24 | new Put( |
25 | 25 | security: 'is_granted(\'ROLE_CLIENT\')', |
26 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
26 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
27 | 27 | ), |
28 | 28 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
29 | 29 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
30 | 30 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
31 | 31 | ], |
32 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
33 | - normalizationContext: ['groups' => ['product_file:read']], |
|
34 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
35 | -)] |
|
36 | -#[ORM\Table(name: 'product_file')] |
|
37 | -#[ORM\Index(name: 'file_id', columns: ['file_id'])] |
|
38 | -#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: ['product_id'])] |
|
39 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'file_id'])] |
|
40 | -#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductFileRepository::class)] |
|
32 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
33 | + normalizationContext: [ 'groups' => [ 'product_file:read' ] ], |
|
34 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
35 | +) ] |
|
36 | +#[ORM\Table(name: 'product_file') ] |
|
37 | +#[ORM\Index(name: 'file_id', columns: [ 'file_id' ]) ] |
|
38 | +#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: [ 'product_id' ]) ] |
|
39 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'file_id' ]) ] |
|
40 | +#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductFileRepository::class) ] |
|
41 | 41 | class ProductFile |
42 | 42 | { |
43 | 43 | /** |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @Groups({"product:read","order_product:read","product_file:read","product_category:read"}) |
47 | 47 | */ |
48 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
49 | - #[ORM\Id] |
|
50 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
48 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
49 | + #[ORM\Id ] |
|
50 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
51 | 51 | private $id; |
52 | 52 | |
53 | 53 | /** |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @Groups({"product:read","order_product:read","product_file:read","product_file:write","product_category:read"}) |
57 | 57 | */ |
58 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact'])] |
|
59 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['file.fileType' => 'exact'])] |
|
60 | - #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id')] |
|
61 | - #[ORM\ManyToOne(targetEntity: \ControleOnline\Entity\File::class)] |
|
58 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'file' => 'exact' ]) ] |
|
59 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'file.fileType' => 'exact' ]) ] |
|
60 | + #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id') ] |
|
61 | + #[ORM\ManyToOne(targetEntity: \ControleOnline\Entity\File::class) ] |
|
62 | 62 | |
63 | 63 | private $file; |
64 | 64 | |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @Groups({"product_file:read","product_file:write"}) |
69 | 69 | */ |
70 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])] |
|
71 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
72 | - #[ORM\ManyToOne(targetEntity: \Product::class)] |
|
70 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'exact' ]) ] |
|
71 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
72 | + #[ORM\ManyToOne(targetEntity: \Product::class) ] |
|
73 | 73 | |
74 | 74 | private $product; |
75 | 75 |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | new Get(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')',), |
24 | 24 | new Put( |
25 | 25 | security: 'is_granted(\'ROLE_CLIENT\')', |
26 | - denormalizationContext: ['groups' => ['product_group_product:write']] |
|
26 | + denormalizationContext: [ 'groups' => [ 'product_group_product:write' ] ] |
|
27 | 27 | ), |
28 | 28 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
29 | 29 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
30 | 30 | new GetCollection(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')',) |
31 | 31 | ], |
32 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
33 | - normalizationContext: ['groups' => ['product_group_product:read']], |
|
34 | - denormalizationContext: ['groups' => ['product_group_product:write']] |
|
35 | -)] |
|
32 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
33 | + normalizationContext: [ 'groups' => [ 'product_group_product:read' ] ], |
|
34 | + denormalizationContext: [ 'groups' => [ 'product_group_product:write' ] ] |
|
35 | +) ] |
|
36 | 36 | |
37 | -#[ApiFilter(OrderFilter::class, properties: ['productGroup.productGroup' => 'ASC', 'product.product' => 'ASC'])] |
|
38 | -#[ORM\Table(name: 'product_group_product')] |
|
39 | -#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductGroupProductRepository::class)] |
|
37 | +#[ApiFilter(OrderFilter::class, properties: [ 'productGroup.productGroup' => 'ASC', 'product.product' => 'ASC' ]) ] |
|
38 | +#[ORM\Table(name: 'product_group_product') ] |
|
39 | +#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductGroupProductRepository::class) ] |
|
40 | 40 | |
41 | 41 | class ProductGroupProduct |
42 | 42 | { |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
47 | 47 | */ |
48 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
49 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
50 | - #[ORM\Id] |
|
51 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
48 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
49 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
50 | + #[ORM\Id ] |
|
51 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
52 | 52 | |
53 | 53 | private $id; |
54 | 54 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
59 | 59 | */ |
60 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])] |
|
61 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false)] |
|
62 | - #[ORM\ManyToOne(targetEntity: \Product::class)] |
|
60 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'exact' ]) ] |
|
61 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false) ] |
|
62 | + #[ORM\ManyToOne(targetEntity: \Product::class) ] |
|
63 | 63 | |
64 | 64 | private $product; |
65 | 65 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
70 | 70 | */ |
71 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
|
72 | - #[ORM\JoinColumn(name: 'product_group_id', referencedColumnName: 'id', nullable: true)] |
|
73 | - #[ORM\ManyToOne(targetEntity: \ProductGroup::class)] |
|
71 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ] |
|
72 | + #[ORM\JoinColumn(name: 'product_group_id', referencedColumnName: 'id', nullable: true) ] |
|
73 | + #[ORM\ManyToOne(targetEntity: \ProductGroup::class) ] |
|
74 | 74 | |
75 | 75 | private $productGroup; |
76 | 76 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
81 | 81 | */ |
82 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productType' => 'exact'])] |
|
83 | - #[ORM\Column(name: 'product_type', type: 'string', columnDefinition: "ENUM('feedstock', 'component', 'package')", nullable: false)] |
|
82 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productType' => 'exact' ]) ] |
|
83 | + #[ORM\Column(name: 'product_type', type: 'string', columnDefinition: "ENUM('feedstock', 'component', 'package')", nullable: false) ] |
|
84 | 84 | |
85 | 85 | private $productType; |
86 | 86 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
91 | 91 | */ |
92 | - #[ORM\JoinColumn(name: 'product_child_id', referencedColumnName: 'id', nullable: true)] |
|
93 | - #[ORM\ManyToOne(targetEntity: \Product::class)] |
|
92 | + #[ORM\JoinColumn(name: 'product_child_id', referencedColumnName: 'id', nullable: true) ] |
|
93 | + #[ORM\ManyToOne(targetEntity: \Product::class) ] |
|
94 | 94 | private $productChild; |
95 | 95 | |
96 | 96 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
100 | 100 | */ |
101 | - #[ORM\Column(name: 'quantity', type: 'float', precision: 10, scale: 2, nullable: false, options: ['default' => '1.00'])] |
|
101 | + #[ORM\Column(name: 'quantity', type: 'float', precision: 10, scale: 2, nullable: false, options: [ 'default' => '1.00' ]) ] |
|
102 | 102 | private $quantity = 0; |
103 | 103 | |
104 | 104 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
108 | 108 | */ |
109 | - #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 2, nullable: false)] |
|
109 | + #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 2, nullable: false) ] |
|
110 | 110 | private $price = 0; |
111 | 111 | |
112 | 112 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @Groups({"product_group_product:read","product_group:write","product_group_product:write"}) |
116 | 116 | */ |
117 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
117 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
118 | 118 | private $active = true; |
119 | 119 | |
120 | 120 | /** |
@@ -27,150 +27,150 @@ |
||
27 | 27 | #[ApiResource( |
28 | 28 | operations: [ |
29 | 29 | new Get(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
30 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product:write']]), |
|
30 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product:write' ] ]), |
|
31 | 31 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
32 | 32 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
33 | 33 | new GetCollection(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
34 | 34 | ], |
35 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
36 | - normalizationContext: ['groups' => ['product:read']], |
|
37 | - denormalizationContext: ['groups' => ['product:write']] |
|
38 | -)] |
|
39 | -#[ApiFilter(OrderFilter::class, properties: ['product', 'price', 'description'])] |
|
40 | -#[ApiFilter(RandomOrderFilter::class)] |
|
41 | -#[ORM\Table(name: 'product')] |
|
42 | -#[ORM\Index(name: 'product_unity_id', columns: ['product_unity_id'])] |
|
43 | -#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: ['company_id'])] |
|
44 | -#[ORM\Index(name: 'default_out_inventory_id', columns: ['default_out_inventory_id'])] |
|
45 | -#[ORM\Index(name: 'default_in_inventory_id', columns: ['default_in_inventory_id'])] |
|
46 | -#[ORM\UniqueConstraint(name: 'company_id', columns: ['company_id', 'sku'])] |
|
47 | -#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductRepository::class)] |
|
35 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
36 | + normalizationContext: [ 'groups' => [ 'product:read' ] ], |
|
37 | + denormalizationContext: [ 'groups' => [ 'product:write' ] ] |
|
38 | +) ] |
|
39 | +#[ApiFilter(OrderFilter::class, properties: [ 'product', 'price', 'description' ]) ] |
|
40 | +#[ApiFilter(RandomOrderFilter::class) ] |
|
41 | +#[ORM\Table(name: 'product') ] |
|
42 | +#[ORM\Index(name: 'product_unity_id', columns: [ 'product_unity_id' ]) ] |
|
43 | +#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: [ 'company_id' ]) ] |
|
44 | +#[ORM\Index(name: 'default_out_inventory_id', columns: [ 'default_out_inventory_id' ]) ] |
|
45 | +#[ORM\Index(name: 'default_in_inventory_id', columns: [ 'default_in_inventory_id' ]) ] |
|
46 | +#[ORM\UniqueConstraint(name: 'company_id', columns: [ 'company_id', 'sku' ]) ] |
|
47 | +#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductRepository::class) ] |
|
48 | 48 | class Product |
49 | 49 | { |
50 | 50 | /** |
51 | 51 | * @var int |
52 | 52 | * @Groups({"product_category:read","product:read","order_product:read"}) |
53 | 53 | */ |
54 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
55 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
56 | - #[ORM\Id] |
|
57 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
54 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
55 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
56 | + #[ORM\Id ] |
|
57 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
58 | 58 | private $id; |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @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"}) |
62 | 62 | */ |
63 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'partial'])] |
|
64 | - #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true)] |
|
63 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'partial' ]) ] |
|
64 | + #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true) ] |
|
65 | 65 | private $product; |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @Groups({"product:read","product_category:read","order_product:read"}) |
69 | 69 | */ |
70 | - #[ApiFilter(filterClass: ExistsFilter::class, properties: ['productFiles'])] |
|
71 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productFiles.file.fileType' => 'exact'])] |
|
72 | - #[ORM\OneToMany(targetEntity: \ProductFile::class, mappedBy: 'product')] |
|
70 | + #[ApiFilter(filterClass: ExistsFilter::class, properties: [ 'productFiles' ]) ] |
|
71 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productFiles.file.fileType' => 'exact' ]) ] |
|
72 | + #[ORM\OneToMany(targetEntity: \ProductFile::class, mappedBy: 'product') ] |
|
73 | 73 | private $productFiles; |
74 | 74 | |
75 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCategory.category' => 'exact'])] |
|
76 | - #[ORM\OneToMany(targetEntity: \ProductCategory::class, mappedBy: 'product')] |
|
75 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCategory.category' => 'exact' ]) ] |
|
76 | + #[ORM\OneToMany(targetEntity: \ProductCategory::class, mappedBy: 'product') ] |
|
77 | 77 | private $productCategory; |
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @var string|null |
81 | 81 | * @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"}) |
82 | 82 | */ |
83 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['sku' => 'partial'])] |
|
84 | - #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: ['default' => 'NULL'])] |
|
83 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'sku' => 'partial' ]) ] |
|
84 | + #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
85 | 85 | private $sku = null; |
86 | 86 | |
87 | 87 | /** |
88 | 88 | * @var string |
89 | 89 | * @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"}) |
90 | 90 | */ |
91 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])] |
|
92 | - #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: ['default' => "'product'"])] |
|
91 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'type' => 'exact' ]) ] |
|
92 | + #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'product'" ]) ] |
|
93 | 93 | private $type = 'product'; |
94 | 94 | |
95 | 95 | /** |
96 | 96 | * @var float |
97 | 97 | * @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"}) |
98 | 98 | */ |
99 | - #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false)] |
|
99 | + #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false) ] |
|
100 | 100 | private $price = 0; |
101 | 101 | |
102 | 102 | /** |
103 | 103 | * @var string |
104 | 104 | * @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"}) |
105 | 105 | */ |
106 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCondition' => 'exact'])] |
|
107 | - #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: ['default' => "'new'"])] |
|
106 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCondition' => 'exact' ]) ] |
|
107 | + #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: [ 'default' => "'new'" ]) ] |
|
108 | 108 | private $productCondition = 'new'; |
109 | 109 | |
110 | 110 | /** |
111 | 111 | * @var string |
112 | 112 | * @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"}) |
113 | 113 | */ |
114 | - #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false)] |
|
114 | + #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false) ] |
|
115 | 115 | private $description = ''; |
116 | 116 | |
117 | 117 | /** |
118 | 118 | * @var bool |
119 | 119 | * @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"}) |
120 | 120 | */ |
121 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['featured' => 'exact'])] |
|
122 | - #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: ['default' => '0'])] |
|
121 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'featured' => 'exact' ]) ] |
|
122 | + #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: [ 'default' => '0' ]) ] |
|
123 | 123 | private $featured = false; |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * @var bool |
127 | 127 | * @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"}) |
128 | 128 | */ |
129 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['active' => 'exact'])] |
|
130 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
129 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'active' => 'exact' ]) ] |
|
130 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
131 | 131 | private $active = true; |
132 | 132 | |
133 | 133 | /** |
134 | 134 | * @var \ControleOnline\Entity\People |
135 | 135 | * @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"}) |
136 | 136 | */ |
137 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])] |
|
138 | - #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')] |
|
139 | - #[ORM\ManyToOne(targetEntity: People::class)] |
|
137 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'company' => 'exact' ]) ] |
|
138 | + #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id') ] |
|
139 | + #[ORM\ManyToOne(targetEntity: People::class) ] |
|
140 | 140 | private $company; |
141 | 141 | |
142 | 142 | /** |
143 | 143 | * @var ProductUnity |
144 | 144 | * @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"}) |
145 | 145 | */ |
146 | - #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id')] |
|
147 | - #[ORM\ManyToOne(targetEntity: \ProductUnity::class)] |
|
146 | + #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id') ] |
|
147 | + #[ORM\ManyToOne(targetEntity: \ProductUnity::class) ] |
|
148 | 148 | private $productUnit; |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * @var Queue |
152 | 152 | * @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"}) |
153 | 153 | */ |
154 | - #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id')] |
|
155 | - #[ORM\ManyToOne(targetEntity: \Queue::class)] |
|
154 | + #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id') ] |
|
155 | + #[ORM\ManyToOne(targetEntity: \Queue::class) ] |
|
156 | 156 | private $queue; |
157 | 157 | |
158 | 158 | /** |
159 | 159 | * @var \ControleOnline\Entity\Inventory |
160 | 160 | * @Groups({"product:read", "product:write"}) |
161 | 161 | */ |
162 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultOutInventory' => 'exact'])] |
|
163 | - #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true)] |
|
164 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
162 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultOutInventory' => 'exact' ]) ] |
|
163 | + #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true) ] |
|
164 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
165 | 165 | private $defaultOutInventory; |
166 | 166 | |
167 | 167 | /** |
168 | 168 | * @var \ControleOnline\Entity\Inventory |
169 | 169 | * @Groups({"product:read", "product:write"}) |
170 | 170 | */ |
171 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultInInventory' => 'exact'])] |
|
172 | - #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true)] |
|
173 | - #[ORM\ManyToOne(targetEntity: Inventory::class)] |
|
171 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultInInventory' => 'exact' ]) ] |
|
172 | + #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true) ] |
|
173 | + #[ORM\ManyToOne(targetEntity: Inventory::class) ] |
|
174 | 174 | private $defaultInInventory; |
175 | 175 | |
176 | 176 | public function __construct() |
@@ -22,51 +22,51 @@ |
||
22 | 22 | #[ApiResource( |
23 | 23 | operations: [ |
24 | 24 | new Get(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
25 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['inventory:write']]), |
|
25 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'inventory:write' ] ]), |
|
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(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
29 | 29 | ], |
30 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
31 | - normalizationContext: ['groups' => ['inventory:read']], |
|
32 | - denormalizationContext: ['groups' => ['inventory:write']] |
|
33 | -)] |
|
34 | -#[ApiFilter(OrderFilter::class, properties: ['inventory', 'type'])] |
|
35 | -#[ApiFilter(SearchFilter::class, properties: ['id' => 'exact', 'inventory' => 'partial', 'type' => 'exact', 'people' => 'exact'])] |
|
36 | -#[ORM\Table(name: 'inventory')] |
|
37 | -#[ORM\Index(name: 'people_id', columns: ['people_id'])] |
|
38 | -#[ORM\Entity(repositoryClass: \ControleOnline\Repository\InventoryRepository::class)] |
|
30 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
31 | + normalizationContext: [ 'groups' => [ 'inventory:read' ] ], |
|
32 | + denormalizationContext: [ 'groups' => [ 'inventory:write' ] ] |
|
33 | +) ] |
|
34 | +#[ApiFilter(OrderFilter::class, properties: [ 'inventory', 'type' ]) ] |
|
35 | +#[ApiFilter(SearchFilter::class, properties: [ 'id' => 'exact', 'inventory' => 'partial', 'type' => 'exact', 'people' => 'exact' ]) ] |
|
36 | +#[ORM\Table(name: 'inventory') ] |
|
37 | +#[ORM\Index(name: 'people_id', columns: [ 'people_id' ]) ] |
|
38 | +#[ORM\Entity(repositoryClass: \ControleOnline\Repository\InventoryRepository::class) ] |
|
39 | 39 | class Inventory |
40 | 40 | { |
41 | 41 | /** |
42 | 42 | * @var int |
43 | 43 | * @Groups({"inventory:read", "inventory:write"}) |
44 | 44 | */ |
45 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
46 | - #[ORM\Id] |
|
47 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
45 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
46 | + #[ORM\Id ] |
|
47 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
48 | 48 | private $id; |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @var string |
52 | 52 | * @Groups({"inventory:read", "inventory:write"}) |
53 | 53 | */ |
54 | - #[ORM\Column(name: 'inventory', type: 'string', length: 255, nullable: false)] |
|
54 | + #[ORM\Column(name: 'inventory', type: 'string', length: 255, nullable: false) ] |
|
55 | 55 | private $inventory; |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @var string |
59 | 59 | * @Groups({"inventory:read", "inventory:write"}) |
60 | 60 | */ |
61 | - #[ORM\Column(name: 'type', type: 'string', length: 50, nullable: false)] |
|
61 | + #[ORM\Column(name: 'type', type: 'string', length: 50, nullable: false) ] |
|
62 | 62 | private $type; |
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @var \ControleOnline\Entity\People |
66 | 66 | * @Groups({"inventory:read", "inventory:write"}) |
67 | 67 | */ |
68 | - #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)] |
|
69 | - #[ORM\ManyToOne(targetEntity: People::class)] |
|
68 | + #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false) ] |
|
69 | + #[ORM\ManyToOne(targetEntity: People::class) ] |
|
70 | 70 | private $people; |
71 | 71 | |
72 | 72 | public function getId(): ?int |
@@ -23,22 +23,22 @@ discard block |
||
23 | 23 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
24 | 24 | new Put( |
25 | 25 | security: 'is_granted(\'ROLE_CLIENT\')', |
26 | - denormalizationContext: ['groups' => ['product_category:write']] |
|
26 | + denormalizationContext: [ 'groups' => [ 'product_category:write' ] ] |
|
27 | 27 | ), |
28 | 28 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
29 | 29 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
30 | 30 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
31 | 31 | ], |
32 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
33 | - normalizationContext: ['groups' => ['product_category:read']], |
|
34 | - denormalizationContext: ['groups' => ['product_category:write']] |
|
35 | -)] |
|
36 | -#[ApiFilter(OrderFilter::class, properties: ['product.product'])] |
|
37 | -#[ORM\Table(name: 'product_category')] |
|
38 | -#[ORM\Index(name: 'category_id', columns: ['category_id'])] |
|
39 | -#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: ['product_id'])] |
|
40 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'category_id'])] |
|
41 | -#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductCategoryRepository::class)] |
|
32 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
33 | + normalizationContext: [ 'groups' => [ 'product_category:read' ] ], |
|
34 | + denormalizationContext: [ 'groups' => [ 'product_category:write' ] ] |
|
35 | +) ] |
|
36 | +#[ApiFilter(OrderFilter::class, properties: [ 'product.product' ]) ] |
|
37 | +#[ORM\Table(name: 'product_category') ] |
|
38 | +#[ORM\Index(name: 'category_id', columns: [ 'category_id' ]) ] |
|
39 | +#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: [ 'product_id' ]) ] |
|
40 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'category_id' ]) ] |
|
41 | +#[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductCategoryRepository::class) ] |
|
42 | 42 | |
43 | 43 | class ProductCategory |
44 | 44 | { |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @Groups({"product_category:read"}) |
49 | 49 | */ |
50 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
51 | - #[ORM\Id] |
|
52 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
50 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
51 | + #[ORM\Id ] |
|
52 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
53 | 53 | private $id; |
54 | 54 | |
55 | 55 | /** |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @Groups({"product_category:read","product_category:write"}) |
59 | 59 | */ |
60 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['category' => 'exact'])] |
|
61 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['category.company' => 'exact'])] |
|
62 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['category.context' => 'exact'])] |
|
63 | - #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')] |
|
64 | - #[ORM\ManyToOne(targetEntity: \ControleOnline\Entity\Category::class)] |
|
60 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'category' => 'exact' ]) ] |
|
61 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'category.company' => 'exact' ]) ] |
|
62 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'category.context' => 'exact' ]) ] |
|
63 | + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id') ] |
|
64 | + #[ORM\ManyToOne(targetEntity: \ControleOnline\Entity\Category::class) ] |
|
65 | 65 | |
66 | 66 | private $category; |
67 | 67 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @Groups({"product_category:read","product_category:write"}) |
72 | 72 | */ |
73 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])] |
|
74 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
75 | - #[ORM\ManyToOne(targetEntity: \Product::class)] |
|
73 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'exact' ]) ] |
|
74 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
75 | + #[ORM\ManyToOne(targetEntity: \Product::class) ] |
|
76 | 76 | |
77 | 77 | private $product; |
78 | 78 |