1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
9
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
13
|
|
|
use DateTime; |
14
|
|
|
use Doctrine\Common\Collections\Collection; |
|
|
|
|
15
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
16
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
20
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\ContractRepository") |
21
|
|
|
*/ |
22
|
|
|
#[ApiResource( |
23
|
|
|
operations: [ |
24
|
|
|
new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
25
|
|
|
new Put( |
26
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
27
|
|
|
uriTemplate: '/contracts/{id}/change/payment', |
28
|
|
|
controller: \App\Controller\ChangeContractPaymentAction::class |
29
|
|
|
), |
30
|
|
|
new Put( |
31
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
32
|
|
|
uriTemplate: '/contracts/{id}/change', |
33
|
|
|
controller: \App\Controller\ChangeContractAction::class |
34
|
|
|
), |
35
|
|
|
new Put( |
36
|
|
|
uriTemplate: 'contracts/{id}/status/{status}', |
37
|
|
|
controller: \App\Controller\ChangeContractStatusAction::class, |
38
|
|
|
openapiContext: [] |
39
|
|
|
), |
40
|
|
|
new Post(), |
41
|
|
|
new GetCollection() |
42
|
|
|
], |
43
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']] |
44
|
|
|
)] |
45
|
|
|
class Contract |
46
|
|
|
{ |
47
|
|
|
/** |
48
|
|
|
* @ORM\Column(type="integer", nullable=false) |
49
|
|
|
* @ORM\Id |
50
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
51
|
|
|
* @Groups({"contract_people:read","logistic_read"}) |
52
|
|
|
*/ |
53
|
|
|
private $id; |
54
|
|
|
/** |
55
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File") |
56
|
|
|
* @ORM\JoinColumns({ |
57
|
|
|
* @ORM\JoinColumn(referencedColumnName="id", nullable=false) |
58
|
|
|
* }) |
59
|
|
|
*/ |
60
|
|
|
private $contractModel; |
61
|
|
|
/** |
62
|
|
|
* @var \ControleOnline\Entity\Status |
|
|
|
|
63
|
|
|
* |
64
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Status") |
65
|
|
|
* @ORM\JoinColumns({ |
66
|
|
|
* @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
67
|
|
|
* }) |
68
|
|
|
* @Groups({"display_read","order_read","order_write"}) |
69
|
|
|
*/ |
70
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])] |
71
|
|
|
|
72
|
|
|
private $status; |
73
|
|
|
//, columnDefinition="enum('Active', 'Canceled', 'Amended')" |
74
|
|
|
/** |
75
|
|
|
* @ORM\Column(name="doc_key", type="string") |
76
|
|
|
* @Groups("contract_people:read") |
77
|
|
|
*/ |
78
|
|
|
private $doc_key; |
79
|
|
|
/** |
80
|
|
|
* @ORM\Column(name="start_date", type="datetime", nullable=false) |
81
|
|
|
* @Groups("contract_people:read") |
82
|
|
|
*/ |
83
|
|
|
private $startDate; |
84
|
|
|
/** |
85
|
|
|
* @ORM\Column(name="end_date", type="datetime", nullable=false) |
86
|
|
|
* @Groups("contract_people:read") |
87
|
|
|
*/ |
88
|
|
|
private $endDate; |
89
|
|
|
/** |
90
|
|
|
* @ORM\Column(name="creation_date", type="datetime", nullable=false) |
91
|
|
|
*/ |
92
|
|
|
private $creationDate; |
93
|
|
|
/** |
94
|
|
|
* @ORM\Column(name="alter_date", type="datetime", nullable=false) |
95
|
|
|
*/ |
96
|
|
|
private $alterDate; |
97
|
|
|
/** |
98
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File") |
99
|
|
|
* @ORM\JoinColumns({ |
100
|
|
|
* @ORM\JoinColumn(name="contract_parent_id", referencedColumnName="id", nullable=true) |
101
|
|
|
* }) |
102
|
|
|
*/ |
103
|
|
|
private $contractParent; |
104
|
|
|
/** |
105
|
|
|
* Many Contracts have Many Peoples. |
106
|
|
|
* |
107
|
|
|
* @ORM\ManyToMany(targetEntity="ControleOnline\Entity\People") |
108
|
|
|
* @ORM\JoinTable(name="contract_people", |
109
|
|
|
* joinColumns={@ORM\JoinColumn(name="contract_id", referencedColumnName="id")}, |
110
|
|
|
* inverseJoinColumns={@ORM\JoinColumn(name="people_id", referencedColumnName="id")} |
111
|
|
|
* ) |
112
|
|
|
*/ |
113
|
|
|
private $peoples; |
114
|
|
|
|
115
|
|
|
|
116
|
|
|
public function __construct() |
117
|
|
|
{ |
118
|
|
|
$this->startDate = new DateTime('now'); |
119
|
|
|
$this->endDate = new DateTime('now'); |
120
|
|
|
$this->creationDate = new DateTime('now'); |
121
|
|
|
$this->alterDate = new DateTime('now'); |
122
|
|
|
} |
123
|
|
|
public function getId(): int |
124
|
|
|
{ |
125
|
|
|
return $this->id; |
126
|
|
|
} |
127
|
|
|
public function getFile(): File |
|
|
|
|
128
|
|
|
{ |
129
|
|
|
return $this->contractModel; |
130
|
|
|
} |
131
|
|
|
public function setFile(File $document_model): Contract |
132
|
|
|
{ |
133
|
|
|
$this->contractModel = $document_model; |
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
public function getKey(): ?string |
137
|
|
|
{ |
138
|
|
|
return $this->doc_key; |
139
|
|
|
} |
140
|
|
|
public function setKey(string $doc_key): Contract |
141
|
|
|
{ |
142
|
|
|
$this->doc_key = $doc_key; |
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set status |
148
|
|
|
* |
149
|
|
|
* @param \ControleOnline\Entity\Status $status |
150
|
|
|
* @return Order |
|
|
|
|
151
|
|
|
*/ |
152
|
|
|
public function setStatus(\ControleOnline\Entity\Status $status = null) |
153
|
|
|
{ |
154
|
|
|
$this->status = $status; |
155
|
|
|
|
156
|
|
|
return $this; |
|
|
|
|
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Get status |
161
|
|
|
* |
162
|
|
|
* @return \ControleOnline\Entity\Status |
163
|
|
|
*/ |
164
|
|
|
public function getStatus() |
165
|
|
|
{ |
166
|
|
|
return $this->status; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function getStartDate(): DateTime |
170
|
|
|
{ |
171
|
|
|
return $this->startDate; |
172
|
|
|
} |
173
|
|
|
public function setStartDate(DateTime $start_date): Contract |
174
|
|
|
{ |
175
|
|
|
$this->startDate = $start_date; |
176
|
|
|
return $this; |
177
|
|
|
} |
178
|
|
|
public function getEndDate(): ?DateTime |
179
|
|
|
{ |
180
|
|
|
return $this->endDate; |
181
|
|
|
} |
182
|
|
|
public function setEndDate(DateTime $end_date): Contract |
183
|
|
|
{ |
184
|
|
|
$this->endDate = $end_date; |
185
|
|
|
return $this; |
186
|
|
|
} |
187
|
|
|
public function getCreationDate(): DateTime |
188
|
|
|
{ |
189
|
|
|
return $this->creationDate; |
190
|
|
|
} |
191
|
|
|
public function setCreationDate(DateTime $creation_date): Contract |
192
|
|
|
{ |
193
|
|
|
$this->creationDate = $creation_date; |
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
public function getAlterDate(): DateTime |
197
|
|
|
{ |
198
|
|
|
return $this->alterDate; |
199
|
|
|
} |
200
|
|
|
public function setAlterDate(DateTime $alter_date): Contract |
201
|
|
|
{ |
202
|
|
|
$this->alterDate = $alter_date; |
203
|
|
|
return $this; |
204
|
|
|
} |
205
|
|
|
/** |
206
|
|
|
* @return mixed |
207
|
|
|
*/ |
208
|
|
|
public function getContractParent() |
209
|
|
|
{ |
210
|
|
|
return $this->contractParent; |
211
|
|
|
} |
212
|
|
|
public function setContractParentId(Contract $contractParent): Contract |
213
|
|
|
{ |
214
|
|
|
$this->contractParent = $contractParent; |
215
|
|
|
return $this; |
216
|
|
|
} |
217
|
|
|
public function getPeoples(): Collection |
218
|
|
|
{ |
219
|
|
|
return $this->peoples; |
220
|
|
|
} |
221
|
|
|
} |
222
|
|
|
|
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