1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
6
|
|
|
use League\HTMLToMarkdown\HtmlConverter; |
|
|
|
|
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\People; |
|
|
|
|
15
|
|
|
use ControleOnline\Entity\Task; |
16
|
|
|
use ControleOnline\Entity\File; |
|
|
|
|
17
|
|
|
use ControleOnline\Repository\TaskInterationRepository; |
18
|
|
|
use ControleOnline\Listener\LogListener; |
|
|
|
|
19
|
|
|
use DateTime; |
20
|
|
|
use DateTimeInterface; |
21
|
|
|
|
22
|
|
|
#[ORM\Table(name: 'task_interations')] |
23
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
24
|
|
|
#[ORM\Entity(repositoryClass: TaskInterationRepository::class)] |
25
|
|
|
#[ApiResource( |
26
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv'], |
27
|
|
|
normalizationContext: ['groups' => ['task_interaction:read']], |
28
|
|
|
denormalizationContext: ['groups' => ['task_interaction:write']], |
29
|
|
|
security: "is_granted('ROLE_CLIENT')", |
30
|
|
|
operations: [ |
31
|
|
|
new GetCollection(security: "is_granted('ROLE_CLIENT')"), |
32
|
|
|
new Get(security: "is_granted('ROLE_CLIENT')"), |
33
|
|
|
new Post(security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") |
34
|
|
|
] |
35
|
|
|
)] |
36
|
|
|
#[ApiFilter(SearchFilter::class, properties: [ |
37
|
|
|
'task' => 'exact', |
38
|
|
|
'task.id' => 'exact', |
39
|
|
|
'task.taskFor' => 'exact', |
40
|
|
|
'registeredBy' => 'exact', |
41
|
|
|
'type' => 'exact', |
42
|
|
|
'visibility' => 'exact', |
43
|
|
|
'read' => 'exact' |
44
|
|
|
])] |
45
|
|
|
class TaskInteration |
46
|
|
|
{ |
47
|
|
|
#[ORM\Column(type: 'integer', nullable: false)] |
48
|
|
|
#[ORM\Id] |
49
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
50
|
|
|
#[Groups(['task_interaction:read'])] |
51
|
|
|
private $id; |
52
|
|
|
|
53
|
|
|
#[ORM\Column(type: 'string', length: 50, nullable: false)] |
54
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
55
|
|
|
private $type; |
56
|
|
|
|
57
|
|
|
#[ORM\Column(name: 'visibility', type: 'string', length: 50, nullable: false)] |
58
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
59
|
|
|
private $visibility; |
60
|
|
|
|
61
|
|
|
#[ORM\Column(type: 'string', nullable: true)] |
62
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
63
|
|
|
private $body; |
64
|
|
|
|
65
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
66
|
|
|
#[ORM\JoinColumn(name: 'registered_by_id', referencedColumnName: 'id', nullable: false)] |
67
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
68
|
|
|
private $registeredBy; |
69
|
|
|
|
70
|
|
|
#[ORM\ManyToOne(targetEntity: Task::class)] |
71
|
|
|
#[ORM\JoinColumn(name: 'task_id', referencedColumnName: 'id', nullable: true)] |
72
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
73
|
|
|
private $task; |
74
|
|
|
|
75
|
|
|
#[ORM\ManyToOne(targetEntity: File::class)] |
76
|
|
|
#[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id', nullable: true)] |
77
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
78
|
|
|
private $file; |
79
|
|
|
|
80
|
|
|
#[ORM\Column(name: 'created_at', type: 'datetime', nullable: false, columnDefinition: 'DATETIME')] |
81
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
82
|
|
|
private $createdAt; |
83
|
|
|
|
84
|
|
|
#[ORM\Column(name: 'is_read', type: 'integer', nullable: false)] |
85
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
86
|
|
|
private $read; |
87
|
|
|
|
88
|
|
|
#[ORM\Column(name: 'notified', type: 'integer', nullable: false)] |
89
|
|
|
#[Groups(['task_interaction:read', 'task_interaction:write'])] |
90
|
|
|
private $notified; |
91
|
|
|
|
92
|
|
|
public function __construct() |
93
|
|
|
{ |
94
|
|
|
$this->createdAt = new DateTime('now'); |
95
|
|
|
$this->visibility = 'private'; |
96
|
|
|
$this->read = 0; |
97
|
|
|
$this->notified = 0; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function getId() |
101
|
|
|
{ |
102
|
|
|
return $this->id; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function getType() |
106
|
|
|
{ |
107
|
|
|
return $this->type; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function setType($type): self |
111
|
|
|
{ |
112
|
|
|
$this->type = $type; |
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function getBody() |
117
|
|
|
{ |
118
|
|
|
return $this->body; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function setBody($body) |
122
|
|
|
{ |
123
|
|
|
// $converter = new HtmlConverter(); |
124
|
|
|
// $this->body = $converter->convert($body); |
125
|
|
|
$this->body = $body; |
126
|
|
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function getRegisteredBy() |
130
|
|
|
{ |
131
|
|
|
return $this->registeredBy; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function setRegisteredBy($registeredBy): self |
135
|
|
|
{ |
136
|
|
|
$this->registeredBy = $registeredBy; |
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function getTask() |
141
|
|
|
{ |
142
|
|
|
return $this->task; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function setTask($task): self |
146
|
|
|
{ |
147
|
|
|
$this->task = $task; |
148
|
|
|
return $this; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
public function getFile() |
152
|
|
|
{ |
153
|
|
|
return $this->file; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public function setFile($file): self |
157
|
|
|
{ |
158
|
|
|
$this->file = $file; |
159
|
|
|
return $this; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
public function getCreatedAt(): DateTimeInterface |
163
|
|
|
{ |
164
|
|
|
return $this->createdAt; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
public function setCreatesAt(DateTimeInterface $createdAt): self |
168
|
|
|
{ |
169
|
|
|
$this->createdAt = $createdAt; |
170
|
|
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
|
174
|
|
|
public function getVisibility() |
175
|
|
|
{ |
176
|
|
|
return $this->visibility; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
public function setVisibility($visibility): self |
180
|
|
|
{ |
181
|
|
|
$this->visibility = $visibility; |
182
|
|
|
return $this; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
public function getRead() |
186
|
|
|
{ |
187
|
|
|
return $this->read; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
public function setRead($read) |
191
|
|
|
{ |
192
|
|
|
$this->read = $read; |
193
|
|
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
public function getNotified() |
197
|
|
|
{ |
198
|
|
|
return $this->notified; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
public function setNotified($notified): self |
202
|
|
|
{ |
203
|
|
|
$this->notified = $notified; |
204
|
|
|
|
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
|
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