Passed
Push — master ( 4a22b4...e9a421 )
by Luiz Kim
15:30 queued 13:06
created
src/Service/ProductGroupService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         RequestStack $requestStack
19 19
 
20 20
     ) {
21
-        $this->request  = $requestStack->getCurrentRequest();
21
+        $this->request = $requestStack->getCurrentRequest();
22 22
     }
23 23
 
24 24
 
Please login to merge, or discard this patch.
src/Repository/ProductRepository.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
src/Service/ProductService.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -32,31 +32,31 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Controller/ProductController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Entity/Inventory.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,50 +16,50 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Entity/ProductFile.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -19,38 +19,38 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Entity/ProductCategory.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,39 +20,39 @@
 block discarded – undo
20 20
         new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'),
21 21
         new Put(
22 22
             security: 'is_granted(\'ROLE_CLIENT\')',
23
-            denormalizationContext: ['groups' => ['product_category:write']]
23
+            denormalizationContext: [ 'groups' => [ 'product_category:write' ] ]
24 24
         ),
25 25
         new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
26 26
         new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
27 27
         new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')')
28 28
     ],
29
-    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
30
-    normalizationContext: ['groups' => ['product_category:read']],
31
-    denormalizationContext: ['groups' => ['product_category:write']]
32
-)]
33
-#[ApiFilter(OrderFilter::class, properties: ['product.product'])]
34
-#[ApiFilter(filterClass: SearchFilter::class, properties: ['category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact'])]
35
-#[ORM\Table(name: 'product_category')]
36
-#[ORM\Index(name: 'category_id', columns: ['category_id'])]
37
-#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: ['product_id'])]
38
-#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'category_id'])]
39
-#[ORM\Entity(repositoryClass: ProductCategoryRepository::class)]
29
+    formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ],
30
+    normalizationContext: [ 'groups' => [ 'product_category:read' ] ],
31
+    denormalizationContext: [ 'groups' => [ 'product_category:write' ] ]
32
+) ]
33
+#[ApiFilter(OrderFilter::class, properties: [ 'product.product' ]) ]
34
+#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact' ]) ]
35
+#[ORM\Table(name: 'product_category') ]
36
+#[ORM\Index(name: 'category_id', columns: [ 'category_id' ]) ]
37
+#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: [ 'product_id' ]) ]
38
+#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'category_id' ]) ]
39
+#[ORM\Entity(repositoryClass: ProductCategoryRepository::class) ]
40 40
 class ProductCategory
41 41
 {
42
-    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
43
-    #[ORM\Id]
44
-    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
45
-    #[Groups(['product_category:read'])]
42
+    #[ORM\Column(name: 'id', type: 'integer', nullable: false) ]
43
+    #[ORM\Id ]
44
+    #[ORM\GeneratedValue(strategy: 'IDENTITY') ]
45
+    #[Groups([ 'product_category:read' ]) ]
46 46
     private int $id;
47 47
 
48
-    #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')]
49
-    #[ORM\ManyToOne(targetEntity: Category::class)]
50
-    #[Groups(['product_category:read', 'product_category:write'])]
48
+    #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id') ]
49
+    #[ORM\ManyToOne(targetEntity: Category::class) ]
50
+    #[Groups([ 'product_category:read', 'product_category:write' ]) ]
51 51
     private Category $category;
52 52
 
53
-    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')]
54
-    #[ORM\ManyToOne(targetEntity: Product::class)]
55
-    #[Groups(['product_category:read', 'product_category:write'])]
53
+    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ]
54
+    #[ORM\ManyToOne(targetEntity: Product::class) ]
55
+    #[Groups([ 'product_category:read', 'product_category:write' ]) ]
56 56
     private Product $product;
57 57
 
58 58
     public function getId(): int
Please login to merge, or discard this patch.
src/Entity/ProductGroup.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -24,66 +24,66 @@  discard block
 block discarded – undo
24 24
         new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'),
25 25
         new Put(
26 26
             security: 'is_granted(\'ROLE_CLIENT\')',
27
-            denormalizationContext: ['groups' => ['product_group:write']]
27
+            denormalizationContext: [ 'groups' => [ 'product_group:write' ] ]
28 28
         ),
29 29
         new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
30 30
         new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
31 31
         new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')')
32 32
     ],
33
-    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
34
-    normalizationContext: ['groups' => ['product_group:read']],
35
-    denormalizationContext: ['groups' => ['product_group:write']]
36
-)]
37
-#[ApiFilter(OrderFilter::class, properties: ['productGroup'])]
38
-#[ORM\Table(name: 'product_group')]
39
-#[ORM\Entity(repositoryClass: ProductGroupRepository::class)]
33
+    formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ],
34
+    normalizationContext: [ 'groups' => [ 'product_group:read' ] ],
35
+    denormalizationContext: [ 'groups' => [ 'product_group:write' ] ]
36
+) ]
37
+#[ApiFilter(OrderFilter::class, properties: [ 'productGroup' ]) ]
38
+#[ORM\Table(name: 'product_group') ]
39
+#[ORM\Entity(repositoryClass: ProductGroupRepository::class) ]
40 40
 class ProductGroup
41 41
 {
42
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
43
-    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
44
-    #[ORM\Id]
45
-    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
46
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
42
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ]
43
+    #[ORM\Column(name: 'id', type: 'integer', nullable: false) ]
44
+    #[ORM\Id ]
45
+    #[ORM\GeneratedValue(strategy: 'IDENTITY') ]
46
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
47 47
     private $id;
48 48
 
49
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])]
50
-    #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false)]
51
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
49
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productGroup' => 'exact' ]) ]
50
+    #[ORM\Column(name: 'product_group', type: 'string', length: 255, nullable: false) ]
51
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
52 52
     private $productGroup;
53 53
 
54
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['priceCalculation' => 'exact'])]
55
-    #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: ['default' => "'sum'"])]
56
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
54
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'priceCalculation' => 'exact' ]) ]
55
+    #[ORM\Column(name: 'price_calculation', type: 'string', length: 0, nullable: false, options: [ 'default' => "'sum'" ]) ]
56
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
57 57
     private $priceCalculation = 'sum';
58 58
 
59
-    #[ORM\Column(name: 'required', type: 'boolean', nullable: false)]
60
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
59
+    #[ORM\Column(name: 'required', type: 'boolean', nullable: false) ]
60
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
61 61
     private $required = false;
62 62
 
63
-    #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: ['default' => 'NULL'])]
64
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
63
+    #[ORM\Column(name: 'minimum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ]
64
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
65 65
     private $minimum = null;
66 66
 
67
-    #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: ['default' => 'NULL'])]
68
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
67
+    #[ORM\Column(name: 'maximum', type: 'integer', nullable: true, options: [ 'default' => 'NULL' ]) ]
68
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
69 69
     private $maximum = null;
70 70
 
71
-    #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])]
72
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
71
+    #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ]
72
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
73 73
     private $active = true;
74 74
 
75
-    #[ORM\Column(name: 'group_order', type: 'integer', nullable: false)]
76
-    #[Groups(['product_group:read', 'product_group:write', 'order_product:read'])]
75
+    #[ORM\Column(name: 'group_order', type: 'integer', nullable: false) ]
76
+    #[Groups([ 'product_group:read', 'product_group:write', 'order_product:read' ]) ]
77 77
     private $groupOrder = 0;
78 78
 
79
-    #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true)]
80
-    #[Groups(['product_group:write'])]
79
+    #[ORM\OneToMany(targetEntity: ProductGroupProduct::class, mappedBy: 'productGroup', orphanRemoval: true) ]
80
+    #[Groups([ 'product_group:write' ]) ]
81 81
     private $products;
82 82
 
83
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['productParent' => 'exact'])]
84
-    #[ORM\JoinColumn(nullable: false)]
85
-    #[ORM\ManyToOne(targetEntity: Product::class)]
86
-    #[Groups(['product_group:read', 'product_group:write'])]
83
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productParent' => 'exact' ]) ]
84
+    #[ORM\JoinColumn(nullable: false) ]
85
+    #[ORM\ManyToOne(targetEntity: Product::class) ]
86
+    #[Groups([ 'product_group:read', 'product_group:write' ]) ]
87 87
     private $productParent;
88 88
 
89 89
     public function __construct()
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function addProduct(ProductGroupProduct $product): self
192 192
     {
193 193
         if (!$this->products->contains($product)) {
194
-            $this->products[] = $product;
194
+            $this->products[ ] = $product;
195 195
             $product->setProductGroup($this);
196 196
         }
197 197
         return $this;
Please login to merge, or discard this patch.
src/Entity/Product.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -24,107 +24,107 @@
 block discarded – undo
24 24
 #[ApiResource(
25 25
     operations: [
26 26
         new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'),
27
-        new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product:write']]),
27
+        new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product:write' ] ]),
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:read']],
34
-    denormalizationContext: ['groups' => ['product:write']]
35
-)]
36
-#[ApiFilter(OrderFilter::class, properties: ['product', 'price', 'description'])]
37
-#[ApiFilter(RandomOrderFilter::class)]
38
-#[ORM\Table(name: 'product')]
39
-#[ORM\Index(name: 'product_unity_id', columns: ['product_unity_id'])]
40
-#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: ['company_id'])]
41
-#[ORM\Index(name: 'default_out_inventory_id', columns: ['default_out_inventory_id'])]
42
-#[ORM\Index(name: 'default_in_inventory_id', columns: ['default_in_inventory_id'])]
43
-#[ORM\UniqueConstraint(name: 'company_id', columns: ['company_id', 'sku'])]
44
-#[ORM\Entity(repositoryClass: ProductRepository::class)]
32
+    formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ],
33
+    normalizationContext: [ 'groups' => [ 'product:read' ] ],
34
+    denormalizationContext: [ 'groups' => [ 'product:write' ] ]
35
+) ]
36
+#[ApiFilter(OrderFilter::class, properties: [ 'product', 'price', 'description' ]) ]
37
+#[ApiFilter(RandomOrderFilter::class) ]
38
+#[ORM\Table(name: 'product') ]
39
+#[ORM\Index(name: 'product_unity_id', columns: [ 'product_unity_id' ]) ]
40
+#[ORM\Index(name: 'IDX_D34A04AD979B1AD6', columns: [ 'company_id' ]) ]
41
+#[ORM\Index(name: 'default_out_inventory_id', columns: [ 'default_out_inventory_id' ]) ]
42
+#[ORM\Index(name: 'default_in_inventory_id', columns: [ 'default_in_inventory_id' ]) ]
43
+#[ORM\UniqueConstraint(name: 'company_id', columns: [ 'company_id', 'sku' ]) ]
44
+#[ORM\Entity(repositoryClass: ProductRepository::class) ]
45 45
 class Product
46 46
 {
47
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
48
-    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
49
-    #[ORM\Id]
50
-    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
51
-    #[Groups(['product_category:read', 'product:read', 'order_product:read'])]
47
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'id' => 'exact' ]) ]
48
+    #[ORM\Column(name: 'id', type: 'integer', nullable: false) ]
49
+    #[ORM\Id ]
50
+    #[ORM\GeneratedValue(strategy: 'IDENTITY') ]
51
+    #[Groups([ 'product_category:read', 'product:read', 'order_product:read' ]) ]
52 52
     private $id;
53 53
 
54
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'partial'])]
55
-    #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true)]
56
-    #[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'])]
54
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'product' => 'partial' ]) ]
55
+    #[ORM\Column(name: 'product', type: 'string', length: 255, nullable: true) ]
56
+    #[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' ]) ]
57 57
     private $product;
58 58
 
59
-    #[ApiFilter(filterClass: ExistsFilter::class, properties: ['productFiles'])]
60
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['productFiles.file.fileType' => 'exact'])]
61
-    #[ORM\OneToMany(targetEntity: ProductFile::class, mappedBy: 'product')]
62
-    #[Groups(['product:read', 'product_category:read', 'order_product:read'])]
59
+    #[ApiFilter(filterClass: ExistsFilter::class, properties: [ 'productFiles' ]) ]
60
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productFiles.file.fileType' => 'exact' ]) ]
61
+    #[ORM\OneToMany(targetEntity: ProductFile::class, mappedBy: 'product') ]
62
+    #[Groups([ 'product:read', 'product_category:read', 'order_product:read' ]) ]
63 63
     private $productFiles;
64 64
 
65
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCategory.category' => 'exact'])]
66
-    #[ORM\OneToMany(targetEntity: ProductCategory::class, mappedBy: 'product')]
65
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCategory.category' => 'exact' ]) ]
66
+    #[ORM\OneToMany(targetEntity: ProductCategory::class, mappedBy: 'product') ]
67 67
     private $productCategory;
68 68
 
69
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['sku' => 'partial'])]
70
-    #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: ['default' => 'NULL'])]
71
-    #[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'])]
69
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'sku' => 'partial' ]) ]
70
+    #[ORM\Column(name: 'sku', type: 'string', length: 32, nullable: true, options: [ 'default' => 'NULL' ]) ]
71
+    #[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' ]) ]
72 72
     private $sku = null;
73 73
 
74
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])]
75
-    #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: ['default' => "'product'"])]
76
-    #[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'])]
74
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'type' => 'exact' ]) ]
75
+    #[ORM\Column(name: 'type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'product'" ]) ]
76
+    #[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' ]) ]
77 77
     private $type = 'product';
78 78
 
79
-    #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false)]
80
-    #[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'])]
79
+    #[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 0, nullable: false) ]
80
+    #[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' ]) ]
81 81
     private $price = 0;
82 82
 
83
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCondition' => 'exact'])]
84
-    #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: ['default' => "'new'"])]
85
-    #[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'])]
83
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'productCondition' => 'exact' ]) ]
84
+    #[ORM\Column(name: 'product_condition', type: 'string', length: 0, nullable: false, options: [ 'default' => "'new'" ]) ]
85
+    #[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' ]) ]
86 86
     private $productCondition = 'new';
87 87
 
88
-    #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false)]
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'])]
88
+    #[ORM\Column(name: 'description', type: 'string', length: 0, nullable: false) ]
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
     private $description = '';
91 91
 
92
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['featured' => 'exact'])]
93
-    #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: ['default' => '0'])]
94
-    #[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'])]
92
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'featured' => 'exact' ]) ]
93
+    #[ORM\Column(name: 'featured', type: 'boolean', nullable: false, options: [ 'default' => '0' ]) ]
94
+    #[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' ]) ]
95 95
     private $featured = false;
96 96
 
97
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['active' => 'exact'])]
98
-    #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])]
99
-    #[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'])]
97
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'active' => 'exact' ]) ]
98
+    #[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: [ 'default' => '1' ]) ]
99
+    #[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' ]) ]
100 100
     private $active = true;
101 101
 
102
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])]
103
-    #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')]
104
-    #[ORM\ManyToOne(targetEntity: People::class)]
105
-    #[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'])]
102
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'company' => 'exact' ]) ]
103
+    #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id') ]
104
+    #[ORM\ManyToOne(targetEntity: People::class) ]
105
+    #[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' ]) ]
106 106
     private $company;
107 107
 
108
-    #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id')]
109
-    #[ORM\ManyToOne(targetEntity: ProductUnity::class)]
110
-    #[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'])]
108
+    #[ORM\JoinColumn(name: 'product_unity_id', referencedColumnName: 'id') ]
109
+    #[ORM\ManyToOne(targetEntity: ProductUnity::class) ]
110
+    #[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' ]) ]
111 111
     private $productUnit;
112 112
 
113
-    #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id')]
114
-    #[ORM\ManyToOne(targetEntity: Queue::class)]
115
-    #[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
+    #[ORM\JoinColumn(name: 'queue_id', referencedColumnName: 'id') ]
114
+    #[ORM\ManyToOne(targetEntity: Queue::class) ]
115
+    #[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' ]) ]
116 116
     private $queue;
117 117
 
118
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultOutInventory' => 'exact'])]
119
-    #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true)]
120
-    #[ORM\ManyToOne(targetEntity: Inventory::class)]
121
-    #[Groups(['product:read', 'product:write'])]
118
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultOutInventory' => 'exact' ]) ]
119
+    #[ORM\JoinColumn(name: 'default_out_inventory_id', referencedColumnName: 'id', nullable: true) ]
120
+    #[ORM\ManyToOne(targetEntity: Inventory::class) ]
121
+    #[Groups([ 'product:read', 'product:write' ]) ]
122 122
     private $defaultOutInventory;
123 123
 
124
-    #[ApiFilter(filterClass: SearchFilter::class, properties: ['defaultInInventory' => 'exact'])]
125
-    #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true)]
126
-    #[ORM\ManyToOne(targetEntity: Inventory::class)]
127
-    #[Groups(['product:read', 'product:write'])]
124
+    #[ApiFilter(filterClass: SearchFilter::class, properties: [ 'defaultInInventory' => 'exact' ]) ]
125
+    #[ORM\JoinColumn(name: 'default_in_inventory_id', referencedColumnName: 'id', nullable: true) ]
126
+    #[ORM\ManyToOne(targetEntity: Inventory::class) ]
127
+    #[Groups([ 'product:read', 'product:write' ]) ]
128 128
     private $defaultInInventory;
129 129
 
130 130
     public function __construct()
Please login to merge, or discard this patch.