@@ -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 | } |
@@ -20,60 +20,60 @@ |
||
20 | 20 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
21 | 21 | new Put( |
22 | 22 | security: 'is_granted(\'ROLE_CLIENT\')', |
23 | - denormalizationContext: ['groups' => ['product_group_product:write']] |
|
23 | + denormalizationContext: [ 'groups' => [ 'product_group_product: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(\'PUBLIC_ACCESS\')') |
28 | 28 | ], |
29 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
30 | - normalizationContext: ['groups' => ['product_group_product:read']], |
|
31 | - denormalizationContext: ['groups' => ['product_group_product:write']] |
|
32 | -)] |
|
33 | -#[ApiFilter(OrderFilter::class, properties: ['productGroup.productGroup' => 'ASC', 'product.product' => 'ASC'])] |
|
34 | -#[ORM\Table(name: 'product_group_product')] |
|
35 | -#[ORM\Entity(repositoryClass: ProductGroupProductRepository::class)] |
|
29 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
30 | + normalizationContext: [ 'groups' => [ 'product_group_product:read' ] ], |
|
31 | + denormalizationContext: [ 'groups' => [ 'product_group_product:write' ] ] |
|
32 | +) ] |
|
33 | +#[ApiFilter(OrderFilter::class, properties: [ 'productGroup.productGroup' => 'ASC', 'product.product' => 'ASC' ]) ] |
|
34 | +#[ORM\Table(name: 'product_group_product') ] |
|
35 | +#[ORM\Entity(repositoryClass: ProductGroupProductRepository::class) ] |
|
36 | 36 | class ProductGroupProduct |
37 | 37 | { |
38 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
39 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
40 | - #[ORM\Id] |
|
41 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
42 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
38 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
39 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
40 | + #[ORM\Id ] |
|
41 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
42 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
43 | 43 | private $id; |
44 | 44 | |
45 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])] |
|
46 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false)] |
|
47 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
48 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
45 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'exact' ]) ] |
|
46 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false) ] |
|
47 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
48 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
49 | 49 | private $product; |
50 | 50 | |
51 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
|
52 | - #[ORM\JoinColumn(name: 'product_group_id', referencedColumnName: 'id', nullable: true)] |
|
53 | - #[ORM\ManyToOne(targetEntity: ProductGroup::class)] |
|
54 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
51 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ] |
|
52 | + #[ORM\JoinColumn(name: 'product_group_id', referencedColumnName: 'id', nullable: true) ] |
|
53 | + #[ORM\ManyToOne(targetEntity: ProductGroup::class) ] |
|
54 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
55 | 55 | private $productGroup; |
56 | 56 | |
57 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productType' => 'exact'])] |
|
58 | - #[ORM\Column(name: 'product_type', type: 'string', columnDefinition: "ENUM('feedstock', 'component', 'package')", nullable: false)] |
|
59 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
57 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productType' => 'exact' ]) ] |
|
58 | + #[ORM\Column(name: 'product_type', type: 'string', columnDefinition: "ENUM('feedstock', 'component', 'package')", nullable: false) ] |
|
59 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
60 | 60 | private $productType; |
61 | 61 | |
62 | - #[ORM\JoinColumn(name: 'product_child_id', referencedColumnName: 'id', nullable: true)] |
|
63 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
64 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
62 | + #[ORM\JoinColumn(name: 'product_child_id', referencedColumnName: 'id', nullable: true) ] |
|
63 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
64 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
65 | 65 | private $productChild; |
66 | 66 | |
67 | - #[ORM\Column(name: 'quantity', type: 'float', precision: 10, scale: 2, nullable: false, options: ['default' => '1.00'])] |
|
68 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
67 | + #[ORM\Column(name: 'quantity', type: 'float', precision: 10, scale: 2, nullable: false, options: [ 'default' => '1.00' ]) ] |
|
68 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
69 | 69 | private $quantity = 0; |
70 | 70 | |
71 | - #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 2, nullable: false)] |
|
72 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
71 | + #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 2, nullable: false) ] |
|
72 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
73 | 73 | private $price = 0; |
74 | 74 | |
75 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
76 | - #[ApiResource(normalizationContext: ['groups' => ['product_group_product:read', 'product_group:write', 'product_group_product:write']])] |
|
75 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
76 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group_product:read', 'product_group:write', 'product_group_product:write' ] ]) ] |
|
77 | 77 | private $active = true; |
78 | 78 | |
79 | 79 | public function getId() |
@@ -16,50 +16,50 @@ |
||
16 | 16 | use ControleOnline\Repository\InventoryRepository; |
17 | 17 | use ControleOnline\Listener\LogListener; |
18 | 18 | |
19 | -#[ORM\Table(name: 'inventory')] |
|
20 | -#[ORM\Index(name: 'people_id', columns: ['people_id'])] |
|
21 | -#[ORM\Entity(repositoryClass: InventoryRepository::class)] |
|
19 | +#[ORM\Table(name: 'inventory') ] |
|
20 | +#[ORM\Index(name: 'people_id', columns: [ 'people_id' ]) ] |
|
21 | +#[ORM\Entity(repositoryClass: InventoryRepository::class) ] |
|
22 | 22 | #[ApiResource( |
23 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv'], |
|
24 | - normalizationContext: ['groups' => ['inventory:read']], |
|
25 | - denormalizationContext: ['groups' => ['inventory:write']], |
|
23 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv' ], |
|
24 | + normalizationContext: [ 'groups' => [ 'inventory:read' ] ], |
|
25 | + denormalizationContext: [ 'groups' => [ 'inventory:write' ] ], |
|
26 | 26 | operations: [ |
27 | 27 | new GetCollection(security: "is_granted('PUBLIC_ACCESS')"), |
28 | 28 | new Get(security: "is_granted('PUBLIC_ACCESS')"), |
29 | 29 | new Post(securityPostDenormalize: "is_granted('ROLE_CLIENT')"), |
30 | 30 | new Put( |
31 | 31 | security: "is_granted('ROLE_CLIENT')", |
32 | - denormalizationContext: ['groups' => ['inventory:write']] |
|
32 | + denormalizationContext: [ 'groups' => [ 'inventory:write' ] ] |
|
33 | 33 | ), |
34 | 34 | new Delete(security: "is_granted('ROLE_CLIENT')") |
35 | 35 | ] |
36 | -)] |
|
37 | -#[ApiFilter(OrderFilter::class, properties: ['inventory', 'type'])] |
|
36 | +) ] |
|
37 | +#[ApiFilter(OrderFilter::class, properties: [ 'inventory', 'type' ]) ] |
|
38 | 38 | #[ApiFilter(SearchFilter::class, properties: [ |
39 | 39 | 'id' => 'exact', |
40 | 40 | 'inventory' => 'partial', |
41 | 41 | 'type' => 'exact', |
42 | 42 | 'people' => 'exact' |
43 | -])] |
|
43 | +]) ] |
|
44 | 44 | class Inventory |
45 | 45 | { |
46 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
47 | - #[ORM\Id] |
|
48 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
49 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
46 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
47 | + #[ORM\Id ] |
|
48 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
49 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
50 | 50 | private $id; |
51 | 51 | |
52 | - #[ORM\Column(name: 'inventory', type: 'string', length: 255, nullable: false)] |
|
53 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
52 | + #[ORM\Column(name: 'inventory', type: 'string', length: 255, nullable: false) ] |
|
53 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
54 | 54 | private $inventory; |
55 | 55 | |
56 | - #[ORM\Column(name: 'type', type: 'string', length: 50, nullable: false)] |
|
57 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
56 | + #[ORM\Column(name: 'type', type: 'string', length: 50, nullable: false) ] |
|
57 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
58 | 58 | private $type; |
59 | 59 | |
60 | - #[ORM\ManyToOne(targetEntity: People::class)] |
|
61 | - #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)] |
|
62 | - #[Groups(['inventory:read', 'inventory:write'])] |
|
60 | + #[ORM\ManyToOne(targetEntity: People::class) ] |
|
61 | + #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false) ] |
|
62 | + #[Groups([ 'inventory:read', 'inventory:write' ]) ] |
|
63 | 63 | private $people; |
64 | 64 | |
65 | 65 | public function getId(): ?int |
@@ -15,31 +15,31 @@ |
||
15 | 15 | #[ApiResource( |
16 | 16 | operations: [ |
17 | 17 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
18 | - new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_unity_edit']]), |
|
18 | + new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_unity_edit' ] ]), |
|
19 | 19 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
20 | 20 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
21 | 21 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
22 | 22 | ], |
23 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
24 | - normalizationContext: ['groups' => ['product_unity:read']], |
|
25 | - denormalizationContext: ['groups' => ['product_unity:write']] |
|
26 | -)] |
|
27 | -#[ORM\Table(name: 'product_unity')] |
|
28 | -#[ORM\Entity(repositoryClass: ProductUnityRepository::class)] |
|
23 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
24 | + normalizationContext: [ 'groups' => [ 'product_unity:read' ] ], |
|
25 | + denormalizationContext: [ 'groups' => [ 'product_unity:write' ] ] |
|
26 | +) ] |
|
27 | +#[ORM\Table(name: 'product_unity') ] |
|
28 | +#[ORM\Entity(repositoryClass: ProductUnityRepository::class) ] |
|
29 | 29 | class ProductUnity |
30 | 30 | { |
31 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
32 | - #[ORM\Id] |
|
33 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
34 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read']])] |
|
31 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
32 | + #[ORM\Id ] |
|
33 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
34 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ] ]) ] |
|
35 | 35 | private $id; |
36 | 36 | |
37 | - #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false)] |
|
38 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read']])] |
|
37 | + #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false) ] |
|
38 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ] ]) ] |
|
39 | 39 | private $productUnit; |
40 | 40 | |
41 | - #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: ['default' => "'I'", 'comment' => 'Integer, Fractioned'])] |
|
42 | - #[ApiResource(normalizationContext: ['groups' => ['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read']])] |
|
41 | + #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'I'", 'comment' => 'Integer, Fractioned' ]) ] |
|
42 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ] ]) ] |
|
43 | 43 | private $unitType = 'I'; |
44 | 44 | |
45 | 45 | public function getId() |
@@ -22,66 +22,66 @@ discard block |
||
22 | 22 | new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
23 | 23 | new Put( |
24 | 24 | security: 'is_granted(\'ROLE_CLIENT\')', |
25 | - denormalizationContext: ['groups' => ['product_group:write']] |
|
25 | + denormalizationContext: [ 'groups' => [ 'product_group:write' ] ] |
|
26 | 26 | ), |
27 | 27 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
28 | 28 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
29 | 29 | new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')') |
30 | 30 | ], |
31 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
32 | - normalizationContext: ['groups' => ['product_group:read']], |
|
33 | - denormalizationContext: ['groups' => ['product_group:write']] |
|
34 | -)] |
|
35 | -#[ApiFilter(OrderFilter::class, properties: ['productGroup'])] |
|
36 | -#[ORM\Table(name: 'product_group')] |
|
37 | -#[ORM\Entity(repositoryClass: ProductGroupRepository::class)] |
|
31 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
32 | + normalizationContext: [ 'groups' => [ 'product_group:read' ] ], |
|
33 | + denormalizationContext: [ 'groups' => [ 'product_group:write' ] ] |
|
34 | +) ] |
|
35 | +#[ApiFilter(OrderFilter::class, properties: [ 'productGroup' ]) ] |
|
36 | +#[ORM\Table(name: 'product_group') ] |
|
37 | +#[ORM\Entity(repositoryClass: ProductGroupRepository::class) ] |
|
38 | 38 | class ProductGroup |
39 | 39 | { |
40 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
41 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
42 | - #[ORM\Id] |
|
43 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
44 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
40 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ] |
|
41 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
42 | + #[ORM\Id ] |
|
43 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
44 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
45 | 45 | private $id; |
46 | 46 | |
47 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
|
48 | - #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false)] |
|
49 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
47 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ] |
|
48 | + #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false) ] |
|
49 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
50 | 50 | private $productGroup; |
51 | 51 | |
52 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['priceCalculation' => 'exact'])] |
|
53 | - #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: ['default' => "'sum'"])] |
|
54 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
52 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'priceCalculation' => 'exact' ]) ] |
|
53 | + #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: [ 'default' => "'sum'" ]) ] |
|
54 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
55 | 55 | private $priceCalculation = 'sum'; |
56 | 56 | |
57 | - #[ORM\Column(name: 'required', type: 'boolean', nullable: false)] |
|
58 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
57 | + #[ORM\Column(name: 'required', type: 'boolean', nullable: false) ] |
|
58 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
59 | 59 | private $required = false; |
60 | 60 | |
61 | - #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: ['default' => 'NULL'])] |
|
62 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
61 | + #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
62 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
63 | 63 | private $minimum = null; |
64 | 64 | |
65 | - #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: ['default' => 'NULL'])] |
|
66 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
65 | + #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ] |
|
66 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
67 | 67 | private $maximum = null; |
68 | 68 | |
69 | - #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
|
70 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
69 | + #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ] |
|
70 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
71 | 71 | private $active = true; |
72 | 72 | |
73 | - #[ORM\Column(name: 'group_order', type: 'integer', nullable: false)] |
|
74 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write', 'order_product:read']])] |
|
73 | + #[ORM\Column(name: 'group_order', type: 'integer', nullable: false) ] |
|
74 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write', 'order_product:read' ] ]) ] |
|
75 | 75 | private $groupOrder = 0; |
76 | 76 | |
77 | - #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true)] |
|
78 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:write']])] |
|
77 | + #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true) ] |
|
78 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:write' ] ]) ] |
|
79 | 79 | private $products; |
80 | 80 | |
81 | - #[ApiFilter(filterClass: SearchFilter::class, properties: ['productParent' => 'exact'])] |
|
82 | - #[ORM\JoinColumn(nullable: false)] |
|
83 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
84 | - #[ApiResource(normalizationContext: ['groups' => ['product_group:read', 'product_group:write']])] |
|
81 | + #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productParent' => 'exact' ]) ] |
|
82 | + #[ORM\JoinColumn(nullable: false) ] |
|
83 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
84 | + #[ApiResource(normalizationContext: [ 'groups' => [ 'product_group:read', 'product_group:write' ] ]) ] |
|
85 | 85 | private $productParent; |
86 | 86 | |
87 | 87 | public function __construct() |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | public function addProduct(ProductGroupProduct $product): self |
190 | 190 | { |
191 | 191 | if (!$this->products->contains($product)) { |
192 | - $this->products[] = $product; |
|
192 | + $this->products[ ] = $product; |
|
193 | 193 | $product->setProductGroup($this); |
194 | 194 | } |
195 | 195 | return $this; |
@@ -19,38 +19,38 @@ |
||
19 | 19 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
20 | 20 | new Put( |
21 | 21 | security: 'is_granted(\'ROLE_CLIENT\')', |
22 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
22 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
23 | 23 | ), |
24 | 24 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
25 | 25 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
26 | 26 | new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
27 | 27 | ], |
28 | - formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
29 | - normalizationContext: ['groups' => ['product_file:read']], |
|
30 | - denormalizationContext: ['groups' => ['product_file:write']] |
|
31 | -)] |
|
32 | -#[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact'])] |
|
33 | -#[ORM\Table(name: 'product_file')] |
|
34 | -#[ORM\Index(name: 'file_id', columns: ['file_id'])] |
|
35 | -#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: ['product_id'])] |
|
36 | -#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'file_id'])] |
|
37 | -#[ORM\Entity(repositoryClass: ProductFileRepository::class)] |
|
28 | + formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ], |
|
29 | + normalizationContext: [ 'groups' => [ 'product_file:read' ] ], |
|
30 | + denormalizationContext: [ 'groups' => [ 'product_file:write' ] ] |
|
31 | +) ] |
|
32 | +#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact' ]) ] |
|
33 | +#[ORM\Table(name: 'product_file') ] |
|
34 | +#[ORM\Index(name: 'file_id', columns: [ 'file_id' ]) ] |
|
35 | +#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: [ 'product_id' ]) ] |
|
36 | +#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'file_id' ]) ] |
|
37 | +#[ORM\Entity(repositoryClass: ProductFileRepository::class) ] |
|
38 | 38 | class ProductFile |
39 | 39 | { |
40 | - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
41 | - #[ORM\Id] |
|
42 | - #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
43 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_category:read'])] |
|
40 | + #[ORM\Column(name: 'id', type: 'integer', nullable: false) ] |
|
41 | + #[ORM\Id ] |
|
42 | + #[ORM\GeneratedValue(strategy: 'IDENTITY') ] |
|
43 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_category:read' ]) ] |
|
44 | 44 | private int $id; |
45 | 45 | |
46 | - #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id')] |
|
47 | - #[ORM\ManyToOne(targetEntity: File::class)] |
|
48 | - #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read'])] |
|
46 | + #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id') ] |
|
47 | + #[ORM\ManyToOne(targetEntity: File::class) ] |
|
48 | + #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_file:write', 'product_category:read' ]) ] |
|
49 | 49 | private File $file; |
50 | 50 | |
51 | - #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')] |
|
52 | - #[ORM\ManyToOne(targetEntity: Product::class)] |
|
53 | - #[Groups(['product_file:read', 'product_file:write'])] |
|
51 | + #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ] |
|
52 | + #[ORM\ManyToOne(targetEntity: Product::class) ] |
|
53 | + #[Groups([ 'product_file:read', 'product_file:write' ]) ] |
|
54 | 54 | private Product $product; |
55 | 55 | |
56 | 56 | public function getId(): int |