1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
6
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
12
|
|
|
use ControleOnline\Listener\LogListener; |
13
|
|
|
use ControleOnline\Repository\SpoolRepository; |
14
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
15
|
|
|
|
16
|
|
|
#[ApiResource( |
17
|
|
|
operations: [ |
18
|
|
|
new Get( |
19
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
20
|
|
|
normalizationContext: ['groups' => ['spool_item:read']], |
21
|
|
|
), |
22
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
23
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
24
|
|
|
], |
25
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
26
|
|
|
normalizationContext: ['groups' => ['spool:read']], |
27
|
|
|
denormalizationContext: ['groups' => ['spool:write']] |
28
|
|
|
)] |
29
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['user' => 'exact', 'people' => 'exact'])] |
30
|
|
|
#[ORM\Table(name: 'spool')] |
31
|
|
|
#[ORM\Index(name: 'device_id_idx', columns: ['device_id'])] |
32
|
|
|
#[ORM\Index(name: 'user_id_idx', columns: ['user_id'])] |
33
|
|
|
#[ORM\Index(name: 'people_id_idx', columns: ['people_id'])] |
34
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
35
|
|
|
#[ORM\Entity(repositoryClass: SpoolRepository::class)] |
36
|
|
|
|
37
|
|
|
class Spool |
38
|
|
|
{ |
39
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
40
|
|
|
#[ORM\Id] |
41
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
42
|
|
|
#[Groups(['spool_item:read', 'spool:read',])] |
43
|
|
|
private $id; |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
47
|
|
|
#[ORM\JoinColumn(name: 'device_id', referencedColumnName: 'id')] |
48
|
|
|
#[Groups(['spool_item:read', 'spool:read', 'spool:write'])] |
49
|
|
|
private $device; |
50
|
|
|
|
51
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
52
|
|
|
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] |
53
|
|
|
#[Groups(['spool_item:read', 'spool:read', 'spool:write'])] |
54
|
|
|
private $user; |
55
|
|
|
|
56
|
|
|
#[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)] |
57
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
58
|
|
|
#[Groups(['spool_item:read', 'spool:read', 'spool:write'])] |
59
|
|
|
private $people; |
60
|
|
|
|
61
|
|
|
#[ORM\Column(name: 'register_date', type: 'datetime', nullable: false)] |
62
|
|
|
#[Groups(['spool_item:read', 'spool:read', 'spool:write'])] |
63
|
|
|
private $registerDate; |
64
|
|
|
|
65
|
|
|
#[ORM\JoinColumn(name: 'status_id', referencedColumnName: 'id', nullable: false)] |
66
|
|
|
#[ORM\ManyToOne(targetEntity: Status::class)] |
67
|
|
|
#[Groups(['spool_item:read', 'spool:read', 'spool:write'])] |
68
|
|
|
private $status; |
69
|
|
|
|
70
|
|
|
#[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id', nullable: false)] |
71
|
|
|
#[ORM\ManyToOne(targetEntity: File::class)] |
72
|
|
|
#[Groups(['spool_item:read', 'spool:read', 'spool:write'])] |
73
|
|
|
private $file; |
74
|
|
|
|
75
|
|
|
public function getId() |
76
|
|
|
{ |
77
|
|
|
return $this->id; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
|
82
|
|
|
public function setUser(User $user): self |
|
|
|
|
83
|
|
|
{ |
84
|
|
|
$this->user = $user; |
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getUser(): User |
89
|
|
|
{ |
90
|
|
|
return $this->user; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function setPeople(People $people): self |
|
|
|
|
94
|
|
|
{ |
95
|
|
|
$this->people = $people; |
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function getPeople(): People |
100
|
|
|
{ |
101
|
|
|
return $this->people; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function setRegisterDate($registerDate): self |
105
|
|
|
{ |
106
|
|
|
$this->registerDate = $registerDate; |
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function getRegisterDate() |
111
|
|
|
{ |
112
|
|
|
return $this->registerDate; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function setStatus(Status $status): self |
116
|
|
|
{ |
117
|
|
|
$this->status = $status; |
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function getStatus(): Status |
122
|
|
|
{ |
123
|
|
|
return $this->status; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public function setFile(File $file): self |
127
|
|
|
{ |
128
|
|
|
$this->file = $file; |
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function getFile(): File |
133
|
|
|
{ |
134
|
|
|
return $this->file; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Get the value of device |
139
|
|
|
*/ |
140
|
|
|
public function getDevice(): Device |
141
|
|
|
{ |
142
|
|
|
return $this->device; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Set the value of device |
147
|
|
|
*/ |
148
|
|
|
public function setDevice(Device $device): self |
149
|
|
|
{ |
150
|
|
|
$this->device = $device; |
151
|
|
|
|
152
|
|
|
return $this; |
153
|
|
|
} |
154
|
|
|
} |
155
|
|
|
|
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