Passed
Push — master ( 8d6a49...a0b965 )
by Luiz Kim
09:19 queued 06:52
created
src/Entity/ProductFile.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,38 +20,38 @@
 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_file:write']]
23
+            denormalizationContext: [ 'groups' => [ 'product_file: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_file:read']],
31
-    denormalizationContext: ['groups' => ['product_file:write']]
32
-)]
33
-#[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact'])]
34
-#[ORM\Table(name: 'product_file')]
35
-#[ORM\Index(name: 'file_id', columns: ['file_id'])]
36
-#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: ['product_id'])]
37
-#[ORM\UniqueConstraint(name: 'product_id', columns: ['product_id', 'file_id'])]
38
-#[ORM\Entity(repositoryClass: ProductFileRepository::class)]
29
+    formats: [ 'jsonld', 'json', 'html', 'jsonhal', 'csv' => [ 'text/csv' ] ],
30
+    normalizationContext: [ 'groups' => [ 'product_file:read' ] ],
31
+    denormalizationContext: [ 'groups' => [ 'product_file:write' ] ]
32
+) ]
33
+#[ApiFilter(filterClass: SearchFilter::class, properties: [ 'file' => 'exact', 'file.fileType' => 'exact', 'product' => 'exact' ]) ]
34
+#[ORM\Table(name: 'product_file') ]
35
+#[ORM\Index(name: 'file_id', columns: [ 'file_id' ]) ]
36
+#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: [ 'product_id' ]) ]
37
+#[ORM\UniqueConstraint(name: 'product_id', columns: [ 'product_id', 'file_id' ]) ]
38
+#[ORM\Entity(repositoryClass: ProductFileRepository::class) ]
39 39
 class ProductFile
40 40
 {
41
-    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
42
-    #[ORM\Id]
43
-    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
44
-    #[Groups(['product:read', 'order_product:read', 'product_file:read', 'product_category:read'])]
41
+    #[ORM\Column(name: 'id', type: 'integer', nullable: false) ]
42
+    #[ORM\Id ]
43
+    #[ORM\GeneratedValue(strategy: 'IDENTITY') ]
44
+    #[Groups([ 'product:read', 'order_product:read', 'product_file:read', 'product_category:read' ]) ]
45 45
     private int $id = 0;
46 46
 
47
-    #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id')]
48
-    #[ORM\ManyToOne(targetEntity: File::class)]
49
-    #[Groups(['product:read', 'order_product:read','order_details:read', 'product_file:read', 'product_file:write', 'product_category:read'])]
47
+    #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id') ]
48
+    #[ORM\ManyToOne(targetEntity: File::class) ]
49
+    #[Groups([ 'product:read', 'order_product:read', 'order_details:read', 'product_file:read', 'product_file:write', 'product_category:read' ]) ]
50 50
     private File $file;
51 51
 
52
-    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')]
53
-    #[ORM\ManyToOne(targetEntity: Product::class)]
54
-    #[Groups(['product_file:read', 'product_file:write'])]
52
+    #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id') ]
53
+    #[ORM\ManyToOne(targetEntity: Product::class) ]
54
+    #[Groups([ 'product_file:read', 'product_file:write' ]) ]
55 55
     private Product $product;
56 56
 
57 57
     public function getId(): int
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_details: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_details: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.