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