1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
6
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
19
|
|
|
* @ORM\Table (name="config", uniqueConstraints={@ORM\UniqueConstraint (name="people_id", columns={"people_id","config_key"})}) |
20
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\ConfigRepository") |
21
|
|
|
*/ |
22
|
|
|
#[ApiResource( |
23
|
|
|
operations: [ |
24
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
25
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
26
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
27
|
|
|
new Post(security: 'is_granted(\'ROLE_CLIENT\')'), |
28
|
|
|
new Put( |
29
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
30
|
|
|
denormalizationContext: ['groups' => ['config_write']] |
31
|
|
|
), |
32
|
|
|
new GetCollection( |
33
|
|
|
security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')', |
34
|
|
|
uriTemplate: '/configs/app-config', |
35
|
|
|
controller: \App\Controller\GetAppConfigAction::class |
36
|
|
|
) |
37
|
|
|
], |
38
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
39
|
|
|
normalizationContext: ['groups' => ['config_read']], |
40
|
|
|
denormalizationContext: ['groups' => ['config_write']] |
41
|
|
|
)] |
42
|
|
|
class Config |
43
|
|
|
{ |
44
|
|
|
/** |
45
|
|
|
* @var integer |
46
|
|
|
* |
47
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
48
|
|
|
* @ORM\Id |
49
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
50
|
|
|
* @Groups({"config_read"}) |
51
|
|
|
*/ |
52
|
|
|
private $id; |
53
|
|
|
/** |
54
|
|
|
* @var \ControleOnline\Entity\People |
|
|
|
|
55
|
|
|
* |
56
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
57
|
|
|
* @ORM\JoinColumns({ |
58
|
|
|
* @ORM\JoinColumn(name="people_id", referencedColumnName="id") |
59
|
|
|
* }) |
60
|
|
|
* @Groups({"config_read","config_write"}) |
61
|
|
|
*/ |
62
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
63
|
|
|
|
64
|
|
|
private $people; |
65
|
|
|
/** |
66
|
|
|
* @var string |
67
|
|
|
* |
68
|
|
|
* @ORM\Column(name="config_key", type="string", length=255, nullable=false) |
69
|
|
|
* @Groups({"config_read","config_write"}) |
70
|
|
|
*/ |
71
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['config_key' => 'exact'])] |
72
|
|
|
|
73
|
|
|
private $config_key; |
74
|
|
|
/** |
75
|
|
|
* @var string |
76
|
|
|
* |
77
|
|
|
* @ORM\Column(name="visibility", type="string", length=255, nullable=false) |
78
|
|
|
* @Groups({"config_read","config_write"}) |
79
|
|
|
|
80
|
|
|
*/ |
81
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['visibility' => 'exact'])] |
82
|
|
|
|
83
|
|
|
private $visibility; |
84
|
|
|
/** |
85
|
|
|
* @var string |
86
|
|
|
* |
87
|
|
|
* @ORM\Column(name="config_value", type="string", length=255, nullable=false) |
88
|
|
|
* @Groups({"config_read","config_write"}) |
89
|
|
|
*/ |
90
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['config_value' => 'exact'])] |
91
|
|
|
|
92
|
|
|
private $config_value; |
93
|
|
|
/** |
94
|
|
|
* @var \ControleOnline\Entity\Module |
95
|
|
|
* |
96
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Module") |
97
|
|
|
* @ORM\JoinColumns({ |
98
|
|
|
* @ORM\JoinColumn(name="module_id", referencedColumnName="id") |
99
|
|
|
* }) |
100
|
|
|
* @Groups({"config_read","config_write"}) |
101
|
|
|
*/ |
102
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['module' => 'exact'])] |
103
|
|
|
private $module; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Get id |
107
|
|
|
* |
108
|
|
|
* @return integer |
109
|
|
|
*/ |
110
|
|
|
public function getId() |
111
|
|
|
{ |
112
|
|
|
return $this->id; |
113
|
|
|
} |
114
|
|
|
/** |
115
|
|
|
* Set people |
116
|
|
|
* |
117
|
|
|
* @param \ControleOnline\Entity\People $people |
118
|
|
|
* @return PeopleConfigKey |
|
|
|
|
119
|
|
|
*/ |
120
|
|
|
public function setPeople(People $people = null) |
121
|
|
|
{ |
122
|
|
|
$this->people = $people; |
123
|
|
|
return $this; |
|
|
|
|
124
|
|
|
} |
125
|
|
|
/** |
126
|
|
|
* Get people |
127
|
|
|
* |
128
|
|
|
* @return \ControleOnline\Entity\People |
129
|
|
|
*/ |
130
|
|
|
public function getPeople() |
131
|
|
|
{ |
132
|
|
|
return $this->people; |
133
|
|
|
} |
134
|
|
|
/** |
135
|
|
|
* Set config_key |
136
|
|
|
* |
137
|
|
|
* @param string config_key |
|
|
|
|
138
|
|
|
* @return PeopleConfigKey |
139
|
|
|
*/ |
140
|
|
|
public function setConfigKey($config_key) |
141
|
|
|
{ |
142
|
|
|
$this->config_key = $config_key; |
143
|
|
|
return $this; |
|
|
|
|
144
|
|
|
} |
145
|
|
|
/** |
146
|
|
|
* Get config_key |
147
|
|
|
* |
148
|
|
|
* @return string |
149
|
|
|
*/ |
150
|
|
|
public function getConfigKey() |
151
|
|
|
{ |
152
|
|
|
return $this->config_key; |
153
|
|
|
} |
154
|
|
|
/** |
155
|
|
|
* Set visibility |
156
|
|
|
* |
157
|
|
|
* @param string visibility |
|
|
|
|
158
|
|
|
* @return Config |
159
|
|
|
*/ |
160
|
|
|
public function setVisibility($visibility) |
161
|
|
|
{ |
162
|
|
|
$this->visibility = $visibility; |
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
/** |
166
|
|
|
* Get visibility |
167
|
|
|
* |
168
|
|
|
* @return string |
169
|
|
|
*/ |
170
|
|
|
public function getVisibility() |
171
|
|
|
{ |
172
|
|
|
return $this->visibility; |
173
|
|
|
} |
174
|
|
|
/** |
175
|
|
|
* Set config_value |
176
|
|
|
* |
177
|
|
|
* @param string config_value |
|
|
|
|
178
|
|
|
* @return PeopleConfigKey |
179
|
|
|
*/ |
180
|
|
|
public function setConfigValue($config_value) |
181
|
|
|
{ |
182
|
|
|
$this->config_value = $config_value; |
183
|
|
|
return $this; |
|
|
|
|
184
|
|
|
} |
185
|
|
|
/** |
186
|
|
|
* Get config_value |
187
|
|
|
* |
188
|
|
|
* @return string |
189
|
|
|
*/ |
190
|
|
|
public function getConfigValue() |
191
|
|
|
{ |
192
|
|
|
return $this->config_value; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* Get the value of module |
197
|
|
|
*/ |
198
|
|
|
public function getModule() |
199
|
|
|
{ |
200
|
|
|
return $this->module; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Set the value of module |
205
|
|
|
*/ |
206
|
|
|
public function setModule($module): self |
207
|
|
|
{ |
208
|
|
|
$this->module = $module; |
209
|
|
|
|
210
|
|
|
return $this; |
211
|
|
|
} |
212
|
|
|
} |
213
|
|
|
|
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