|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
|
|
12
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
|
|
13
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
14
|
|
|
use ControleOnline\Entity\Invoice; |
|
|
|
|
|
|
15
|
|
|
use ControleOnline\Entity\Order; |
|
16
|
|
|
use ControleOnline\Listener\LogListener; |
|
17
|
|
|
|
|
18
|
|
|
#[ORM\Table(name: 'order_invoice')] |
|
19
|
|
|
#[ORM\Index(name: 'invoice_id', columns: ['invoice_id'])] |
|
20
|
|
|
#[ORM\UniqueConstraint(name: 'order_id', columns: ['order_id', 'invoice_id'])] |
|
21
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
|
22
|
|
|
#[ORM\Entity] |
|
23
|
|
|
#[ApiResource( |
|
24
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
25
|
|
|
normalizationContext: ['groups' => ['order_invoice:read']], |
|
26
|
|
|
denormalizationContext: ['groups' => ['order_invoice:write']], |
|
27
|
|
|
operations: [ |
|
28
|
|
|
new GetCollection(security: "is_granted('ROLE_CLIENT')"), |
|
29
|
|
|
new Get(security: "is_granted('ROLE_CLIENT')"), |
|
30
|
|
|
new Post( |
|
31
|
|
|
security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')", |
|
32
|
|
|
validationContext: ['groups' => ['order_invoice:write']], |
|
33
|
|
|
denormalizationContext: ['groups' => ['order_invoice:write']] |
|
34
|
|
|
) |
|
35
|
|
|
] |
|
36
|
|
|
)] |
|
37
|
|
|
#[ApiFilter(SearchFilter::class, properties: [ |
|
38
|
|
|
'invoice' => 'exact', |
|
39
|
|
|
'order' => 'exact' |
|
40
|
|
|
])] |
|
41
|
|
|
class OrderInvoice |
|
42
|
|
|
{ |
|
43
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
44
|
|
|
#[ORM\Id] |
|
45
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
46
|
|
|
#[Groups(['order_invoice:read', 'order:read'])] |
|
47
|
|
|
private $id; |
|
48
|
|
|
|
|
49
|
|
|
#[ORM\ManyToOne(targetEntity: Invoice::class, inversedBy: 'order', cascade: ['persist'])] |
|
50
|
|
|
#[ORM\JoinColumn(name: 'invoice_id', referencedColumnName: 'id')] |
|
51
|
|
|
#[Groups(['order_invoice:read', 'order:read', 'order_details:read', 'order:write', 'order_invoice:write'])] |
|
52
|
|
|
private $invoice; |
|
53
|
|
|
|
|
54
|
|
|
#[ORM\ManyToOne(targetEntity: Order::class, inversedBy: 'invoice', cascade: ['persist'])] |
|
55
|
|
|
#[ORM\JoinColumn(name: 'order_id', referencedColumnName: 'id')] |
|
56
|
|
|
#[Groups(['invoice:read', 'invoice_details:read', 'order_invoice:read', 'order_invoice:write'])] |
|
57
|
|
|
private $order; |
|
58
|
|
|
|
|
59
|
|
|
#[ORM\Column(name: 'real_price', type: 'float', nullable: false)] |
|
60
|
|
|
#[Groups(['order_invoice:read', 'order:read', 'order_details:read', 'order:write', 'order_invoice:write'])] |
|
61
|
|
|
private $realPrice = 0; |
|
62
|
|
|
|
|
63
|
|
|
public function getId() |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->id; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function setInvoice(Invoice $invoice) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->invoice = $invoice; |
|
71
|
|
|
return $this; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getInvoice() |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->invoice; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function setOrder(Order $order) |
|
80
|
|
|
{ |
|
81
|
|
|
$this->order = $order; |
|
82
|
|
|
return $this; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getOrder() |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->order; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function setRealPrice($realPrice) |
|
91
|
|
|
{ |
|
92
|
|
|
$this->realPrice = $realPrice; |
|
93
|
|
|
return $this; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getRealPrice() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->realPrice; |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths