@@ -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 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | $this->peopleService->getMyCompanies() |
52 | 52 | ); |
53 | 53 | |
54 | - if ($company) |
|
55 | - $qb->andWhere('pe = :company')->setParameter('company', $company); |
|
54 | + if ($company) { |
|
55 | + $qb->andWhere('pe = :company')->setParameter('company', $company); |
|
56 | + } |
|
56 | 57 | |
57 | 58 | return $qb->getQuery()->getResult(); |
58 | 59 | } |
@@ -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,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 |
@@ -21,8 +21,8 @@ |
||
21 | 21 | use ApiPlatform\Metadata\ApiResource; |
22 | 22 | |
23 | 23 | /** |
24 | - * ProductUnity |
|
25 | - */ |
|
24 | + * ProductUnity |
|
25 | + */ |
|
26 | 26 | #[ApiResource( |
27 | 27 | operations: [ |
28 | 28 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
@@ -26,17 +26,17 @@ 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_unity_edit']]), |
|
29 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_unity_edit' ] ]), |
|
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_unity:read']], |
|
36 | - denormalizationContext: ['groups' => ['product_unity:write']] |
|
37 | -)] |
|
38 | - #[ORM\Table(name: 'product_unity')] |
|
39 | - #[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductUnityRepository::class)] |
|
34 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
35 | + normalizationContext: [ 'groups' => [ 'product_unity:read' ] ], |
|
36 | + denormalizationContext: [ 'groups' => [ 'product_unity:write' ] ] |
|
37 | +) ] |
|
38 | + #[ORM\Table(name: 'product_unity') ] |
|
39 | + #[ORM\Entity(repositoryClass: \ControleOnline\Repository\ProductUnityRepository::class) ] |
|
40 | 40 | class ProductUnity |
41 | 41 | { |
42 | 42 | /** |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @Groups({"product:read","product_group_product:read","product_group:read","product_unity:read"}) |
46 | 46 | */ |
47 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
48 | - #[ORM\Id] |
|
49 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
47 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
48 | + #[ORM\Id ] |
|
49 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
50 | 50 | private $id; |
51 | 51 | |
52 | 52 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @Groups({"product:read","product_group_product:read","product_group:read","product_unity:read"}) |
56 | 56 | */ |
57 | - #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false)] |
|
57 | + #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false) ] |
|
58 | 58 | private $productUnit; |
59 | 59 | |
60 | 60 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @Groups({"product:read","product_group_product:read","product_group:read","product_unity:read"}) |
64 | 64 | */ |
65 | - #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: ['default' => "'I'", 'comment' => 'Integer, Fractioned'])] |
|
65 | + #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'I'", 'comment' => 'Integer, Fractioned' ]) ] |
|
66 | 66 | private $unitType = 'I'; |
67 | 67 | |
68 | 68 | /** |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')',), |
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(\'PUBLIC_ACCESS\')',) |
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 | /** |
@@ -22,51 +22,51 @@ |
||
22 | 22 | #[ApiResource( |
23 | 23 | operations: [ |
24 | 24 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
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(\'PUBLIC_ACCESS\')'), |
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 |