Passed
Push — master ( 8d6a49...a0b965 )
by Luiz Kim
09:19 queued 06:52
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/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/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/ProductUnity.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@
 block discarded – undo
17 17
 #[ApiResource(
18 18
     operations: [
19 19
         new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'),
20
-        new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_unity_edit']]),
20
+        new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_unity_edit' ] ]),
21 21
         new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
22 22
         new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
23 23
         new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')')
24 24
     ],
25
-    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
26
-    normalizationContext: ['groups' => ['product_unity:read']],
27
-    denormalizationContext: ['groups' => ['product_unity:write']]
28
-)]
29
-#[ORM\Table(name: 'product_unity')]
30
-#[ORM\Entity(repositoryClass: ProductUnityRepository::class)]
25
+    formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ],
26
+    normalizationContext: [ 'groups' => [ 'product_unity:read' ] ],
27
+    denormalizationContext: [ 'groups' => [ 'product_unity:write' ] ]
28
+) ]
29
+#[ORM\Table(name: 'product_unity') ]
30
+#[ORM\Entity(repositoryClass: ProductUnityRepository::class) ]
31 31
 class ProductUnity
32 32
 {
33
-    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
34
-    #[ORM\Id]
35
-    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
36
-    #[Groups(['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read'])]
33
+    #[ORM\Column(name: 'id', type: 'integer', nullable: false) ]
34
+    #[ORM\Id ]
35
+    #[ORM\GeneratedValue(strategy: 'IDENTITY') ]
36
+    #[Groups([ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ]) ]
37 37
     private $id;
38 38
 
39
-    #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false)]
40
-    #[Groups(['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read'])]
39
+    #[ORM\Column(name: 'product_unit', type: 'string', length: 3, nullable: false) ]
40
+    #[Groups([ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ]) ]
41 41
     private $productUnit;
42 42
 
43
-    #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: ['default' => "'I'", 'comment' => 'Integer, Fractioned'])]
44
-    #[Groups(['product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read'])]
43
+    #[ORM\Column(name: 'unit_type', type: 'string', length: 0, nullable: false, options: [ 'default' => "'I'", 'comment' => 'Integer, Fractioned' ]) ]
44
+    #[Groups([ 'product:read', 'product_group_product:read', 'product_group:read', 'product_unity:read' ]) ]
45 45
     private $unitType = 'I';
46 46
 
47 47
     public function getId()
Please login to merge, or discard this patch.
src/Entity/ProductInventory.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -20,61 +20,61 @@
 block discarded – undo
20 20
 #[ApiResource(
21 21
     operations: [
22 22
         new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'),
23
-        new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_inventory:write']]),
23
+        new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: [ 'groups' => [ 'product_inventory:write' ] ]),
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(\'PUBLIC_ACCESS\')'),
27 27
     ],
28
-    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
29
-    normalizationContext: ['groups' => ['product_inventory:read']],
30
-    denormalizationContext: ['groups' => ['product_inventory:write']]
31
-)]
32
-#[ApiFilter(OrderFilter::class, properties: ['id', 'available', 'sales', 'ordered', 'transit'])]
33
-#[ApiFilter(SearchFilter::class, properties: ['id' => 'exact', 'inventory' => 'exact', 'product' => 'exact'])]
34
-#[ORM\Table(name: 'product_inventory')]
35
-#[ORM\Index(name: 'inventory_id', columns: ['inventory_id'])]
36
-#[ORM\Index(name: 'product_id', columns: ['product_id'])]
37
-#[ORM\Entity(repositoryClass: ProductInventoryRepository::class)]
28
+    formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ],
29
+    normalizationContext: [ 'groups' => [ 'product_inventory:read' ] ],
30
+    denormalizationContext: [ 'groups' => [ 'product_inventory:write' ] ]
31
+) ]
32
+#[ApiFilter(OrderFilter::class, properties: [ 'id', 'available', 'sales', 'ordered', 'transit' ]) ]
33
+#[ApiFilter(SearchFilter::class, properties: [ 'id' => 'exact', 'inventory' => 'exact', 'product' => 'exact' ]) ]
34
+#[ORM\Table(name: 'product_inventory') ]
35
+#[ORM\Index(name: 'inventory_id', columns: [ 'inventory_id' ]) ]
36
+#[ORM\Index(name: 'product_id', columns: [ 'product_id' ]) ]
37
+#[ORM\Entity(repositoryClass: ProductInventoryRepository::class) ]
38 38
 class ProductInventory
39 39
 {
40
-    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
41
-    #[ORM\Id]
42
-    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
43
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
40
+    #[ORM\Column(name: 'id', type: 'integer', nullable: false) ]
41
+    #[ORM\Id ]
42
+    #[ORM\GeneratedValue(strategy: 'IDENTITY') ]
43
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
44 44
     private $id;
45 45
 
46
-    #[ORM\JoinColumn(name: 'inventory_id', referencedColumnName: 'id', nullable: false)]
47
-    #[ORM\ManyToOne(targetEntity: Inventory::class)]
48
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
46
+    #[ORM\JoinColumn(name: 'inventory_id', referencedColumnName: 'id', nullable: false) ]
47
+    #[ORM\ManyToOne(targetEntity: Inventory::class) ]
48
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
49 49
     private $inventory;
50 50
 
51
-    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false)]
52
-    #[ORM\ManyToOne(targetEntity: Product::class)]
53
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
51
+    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false) ]
52
+    #[ORM\ManyToOne(targetEntity: Product::class) ]
53
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
54 54
     private $product;
55 55
 
56
-    #[ORM\Column(name: 'available', type: 'integer', nullable: false, options: ['default' => 0])]
57
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
56
+    #[ORM\Column(name: 'available', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ]
57
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
58 58
     private $available = 0;
59 59
 
60
-    #[ORM\Column(name: 'sales', type: 'integer', nullable: false, options: ['default' => 0])]
61
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
60
+    #[ORM\Column(name: 'sales', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ]
61
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
62 62
     private $sales = 0;
63 63
 
64
-    #[ORM\Column(name: 'ordered', type: 'integer', nullable: false, options: ['default' => 0])]
65
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
64
+    #[ORM\Column(name: 'ordered', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ]
65
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
66 66
     private $ordered = 0;
67 67
 
68
-    #[ORM\Column(name: 'transit', type: 'integer', nullable: false, options: ['default' => 0])]
69
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
68
+    #[ORM\Column(name: 'transit', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ]
69
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
70 70
     private $transit = 0;
71 71
 
72
-    #[ORM\Column(name: 'minimum', type: 'integer', nullable: false, options: ['default' => 0])]
73
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
72
+    #[ORM\Column(name: 'minimum', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ]
73
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
74 74
     private $minimum = 0;
75 75
 
76
-    #[ORM\Column(name: 'maximum', type: 'integer', nullable: false, options: ['default' => 0])]
77
-    #[Groups(['product_inventory:read', 'product_inventory:write'])]
76
+    #[ORM\Column(name: 'maximum', type: 'integer', nullable: false, options: [ 'default' => 0 ]) ]
77
+    #[Groups([ 'product_inventory:read', 'product_inventory:write' ]) ]
78 78
     private $maximum = 0;
79 79
 
80 80
     public function getId(): ?int
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
@@ -34,31 +34,31 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $products = $this->getProductsInventory($provider);
36 36
 
37
-        $groupedByInventory = [];
37
+        $groupedByInventory = [ ];
38 38
         foreach ($products as $product) {
39
-            $inventoryName = $product['inventory_name'];
40
-            if (!isset($groupedByInventory[$inventoryName])) {
41
-                $groupedByInventory[$inventoryName] = [];
39
+            $inventoryName = $product[ 'inventory_name' ];
40
+            if (!isset($groupedByInventory[ $inventoryName ])) {
41
+                $groupedByInventory[ $inventoryName ] = [ ];
42 42
             }
43
-            $groupedByInventory[$inventoryName][] = $product;
43
+            $groupedByInventory[ $inventoryName ][ ] = $product;
44 44
         }
45 45
 
46 46
         foreach ($groupedByInventory as $inventoryName => $items) {
47
-            $companyName = $items[0]['company_name'];
47
+            $companyName = $items[ 0 ][ 'company_name' ];
48 48
             $this->printService->addLine("", "", "-");
49 49
             $this->printService->addLine($companyName, "", " ");
50
-            $this->printService->addLine("INVENTARIO: " . $inventoryName, "", " ");
50
+            $this->printService->addLine("INVENTARIO: ".$inventoryName, "", " ");
51 51
             $this->printService->addLine("", "", "-");
52 52
             $this->printService->addLine("Produto", "Disponivel", " ");
53 53
             $this->printService->addLine("", "", "-");
54 54
 
55 55
             foreach ($items as $item) {
56
-                $productName = substr($item['product_name'], 0, 20);
57
-                if (!empty($item['description'])) {
58
-                    $productName .= " " . substr($item['description'], 0, 10);
56
+                $productName = substr($item[ 'product_name' ], 0, 20);
57
+                if (!empty($item[ 'description' ])) {
58
+                    $productName .= " ".substr($item[ 'description' ], 0, 10);
59 59
                 }
60
-                $productName .= " (" . $item['productUnit'] . ")";
61
-                $available = str_pad($item['available'], 4, " ", STR_PAD_LEFT);
60
+                $productName .= " (".$item[ 'productUnit' ].")";
61
+                $available = str_pad($item[ 'available' ], 4, " ", STR_PAD_LEFT);
62 62
                 $this->printService->addLine($productName, $available, " ");
63 63
             }
64 64
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $products = $this->getPurchasingSuggestion($provider);
79 79
 
80
-        $groupedByCompany = [];
80
+        $groupedByCompany = [ ];
81 81
         foreach ($products as $product) {
82
-            $companyName = $product['company_name'];
83
-            if (!isset($groupedByCompany[$companyName])) {
84
-                $groupedByCompany[$companyName] = [];
82
+            $companyName = $product[ 'company_name' ];
83
+            if (!isset($groupedByCompany[ $companyName ])) {
84
+                $groupedByCompany[ $companyName ] = [ ];
85 85
             }
86
-            $groupedByCompany[$companyName][] = $product;
86
+            $groupedByCompany[ $companyName ][ ] = $product;
87 87
         }
88 88
 
89 89
         $this->printService->addLine("", "", "-");
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
             $this->printService->addLine("", "", "-");
98 98
 
99 99
             foreach ($items as $item) {
100
-                $productName = substr($item['product_name'], 0, 20);
101
-                if (!empty($item['description'])) {
102
-                    $productName .= " " . substr($item['description'], 0, 10);
100
+                $productName = substr($item[ 'product_name' ], 0, 20);
101
+                if (!empty($item[ 'description' ])) {
102
+                    $productName .= " ".substr($item[ 'description' ], 0, 10);
103 103
                 }
104
-                if (!empty($item['unity'])) {
105
-                    $productName .= " (" . $item['unity'] . ")";
104
+                if (!empty($item[ 'unity' ])) {
105
+                    $productName .= " (".$item[ 'unity' ].")";
106 106
                 }
107
-                $needed = str_pad($item['needed'], 4, " ", STR_PAD_LEFT);
107
+                $needed = str_pad($item[ 'needed' ], 4, " ", STR_PAD_LEFT);
108 108
                 $this->printService->addLine($productName, $needed, " ");
109 109
             }
110 110
 
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
@@ -21,39 +21,39 @@
 block discarded – undo
21 21
         new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'),
22 22
         new Put(
23 23
             security: 'is_granted(\'ROLE_CLIENT\')',
24
-            denormalizationContext: ['groups' => ['product_category:write']]
24
+            denormalizationContext: [ 'groups' => [ 'product_category:write' ] ]
25 25
         ),
26 26
         new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
27 27
         new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
28 28
         new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')')
29 29
     ],
30
-    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
31
-    normalizationContext: ['groups' => ['product_category:read']],
32
-    denormalizationContext: ['groups' => ['product_category:write']]
33
-)]
34
-#[ApiFilter(OrderFilter::class, properties: ['product.product'])]
35
-#[ApiFilter(filterClass: SearchFilter::class, properties: ['category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact'])]
36
-#[ORM\Table(name: 'product_category')]
37
-#[ORM\Index(name: 'category_id', columns: ['category_id'])]
38
-#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: ['product_id'])]
39
-#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'category_id'])]
40
-#[ORM\Entity(repositoryClass: ProductCategoryRepository::class)]
30
+    formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ],
31
+    normalizationContext: [ 'groups' => [ 'product_category:read' ] ],
32
+    denormalizationContext: [ 'groups' => [ 'product_category:write' ] ]
33
+) ]
34
+#[ApiFilter(OrderFilter::class, properties: [ 'product.product' ]) ]
35
+#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'category' => 'exact', 'category.company' => 'exact', 'category.context' => 'exact', 'product' => 'exact' ]) ]
36
+#[ORM\Table(name: 'product_category') ]
37
+#[ORM\Index(name: 'category_id', columns: [ 'category_id' ]) ]
38
+#[ORM\Index(name: 'IDX_CDFC73564584665A', columns: [ 'product_id' ]) ]
39
+#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'category_id' ]) ]
40
+#[ORM\Entity(repositoryClass: ProductCategoryRepository::class) ]
41 41
 class ProductCategory
42 42
 {
43
-    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
44
-    #[ORM\Id]
45
-    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
46
-    #[Groups(['product_category:read'])]
43
+    #[ORM\Column(name: 'id', type: 'integer', nullable: false) ]
44
+    #[ORM\Id ]
45
+    #[ORM\GeneratedValue(strategy: 'IDENTITY') ]
46
+    #[Groups([ 'product_category:read' ]) ]
47 47
     private int $id = 0;
48 48
 
49
-    #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')]
50
-    #[ORM\ManyToOne(targetEntity: Category::class)]
51
-    #[Groups(['product_category:read', 'product_category:write'])]
49
+    #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id') ]
50
+    #[ORM\ManyToOne(targetEntity: Category::class) ]
51
+    #[Groups([ 'product_category:read', 'product_category:write' ]) ]
52 52
     private Category $category;
53 53
 
54
-    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')]
55
-    #[ORM\ManyToOne(targetEntity: Product::class)]
56
-    #[Groups(['product_category:read', 'product_category:write'])]
54
+    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ]
55
+    #[ORM\ManyToOne(targetEntity: Product::class) ]
56
+    #[Groups([ 'product_category:read', 'product_category:write' ]) ]
57 57
     private Product $product;
58 58
 
59 59
     public function getId(): int
Please login to merge, or discard this patch.
src/Controller/ProductController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
 
26 26
     ) {}
27 27
 
28
-    #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: ['GET'])]
29
-    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")]
28
+    #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: [ 'GET' ]) ]
29
+    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ]
30 30
     public function getPurchasingSuggestion(Request $request): JsonResponse
31 31
     {
32
-        $company =  $this->manager->getRepository(People::class)->find($request->get('company'));
32
+        $company = $this->manager->getRepository(People::class)->find($request->get('company'));
33 33
         $data = $this->productService->getPurchasingSuggestion($company);
34 34
         return new JsonResponse($data);
35 35
     }
36 36
 
37
-    #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: ['POST'])]
38
-    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")]
37
+    #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: [ 'POST' ]) ]
38
+    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ]
39 39
     public function printPurchasingSuggestion(Request $request): JsonResponse
40 40
     {
41 41
         try {
42 42
             $data = json_decode($request->getContent(), true);
43 43
             $device = $this->manager->getRepository(Device::class)->findOneBy([
44
-                'device' => $data['device']
44
+                'device' => $data[ 'device' ]
45 45
             ]);
46
-            $company = $this->manager->getRepository(People::class)->find($data['people']);
46
+            $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]);
47 47
             $printData = $this->productService->purchasingSuggestionPrintData($company, $device);
48 48
 
49 49
             return new JsonResponse($this->hydratorService->item(Spool::class, $printData->getId(), "spool_item:read"), Response::HTTP_OK);
@@ -52,26 +52,26 @@  discard block
 block discarded – undo
52 52
         }
53 53
     }
54 54
 
55
-    #[Route('/products/inventory', name: 'products_inventory', methods: ['GET'])]
56
-    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")]
55
+    #[Route('/products/inventory', name: 'products_inventory', methods: [ 'GET' ]) ]
56
+    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ]
57 57
     public function getProductsInventory(Request $request): JsonResponse
58 58
     {
59
-        $company =  $this->manager->getRepository(People::class)->find($request->get('company'));
59
+        $company = $this->manager->getRepository(People::class)->find($request->get('company'));
60 60
         $data = $this->productService->getProductsInventory($company);
61 61
         return new JsonResponse($data);
62 62
     }
63 63
 
64
-    #[Route('/products/inventory/print', name: 'products_inventory_print', methods: ['POST'])]
65
-    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")]
64
+    #[Route('/products/inventory/print', name: 'products_inventory_print', methods: [ 'POST' ]) ]
65
+    #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ]
66 66
     public function print(Request $request): JsonResponse
67 67
     {
68 68
         try {
69 69
             $data = json_decode($request->getContent(), true);
70 70
             $device = $this->manager->getRepository(Device::class)->findOneBy([
71
-                'device' => $data['device']
71
+                'device' => $data[ 'device' ]
72 72
             ]);
73 73
 
74
-            $company = $this->manager->getRepository(People::class)->find($data['people']);
74
+            $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]);
75 75
             $printData = $this->productService->productsInventoryPrintData($company, $device);
76 76
             return new JsonResponse($this->hydratorService->item(Spool::class, $printData->getId(), "spool_item:read"), Response::HTTP_OK);
77 77
         } catch (Exception $e) {
Please login to merge, or discard this patch.