1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
9
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
14
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
15
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
19
|
|
|
* @ORM\Table (name="extra_fields") |
20
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\ExtraFieldsRepository") |
21
|
|
|
*/ |
22
|
|
|
#[ApiResource( |
23
|
|
|
operations: [ |
24
|
|
|
new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
25
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
26
|
|
|
new Put( |
27
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
28
|
|
|
validationContext: ['groups' => ['extra_fields_write']], |
29
|
|
|
denormalizationContext: ['groups' => ['extra_fields_write']] |
30
|
|
|
), |
31
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
32
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
33
|
|
|
], |
34
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
35
|
|
|
normalizationContext: ['groups' => ['extra_fields_read']], |
36
|
|
|
denormalizationContext: ['groups' => ['extra_fields_write']] |
37
|
|
|
)] |
38
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['context' => 'exact', 'field_type' => 'exact'])] |
39
|
|
|
class ExtraFields |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* @var integer |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
45
|
|
|
* @ORM\Id |
46
|
|
|
* @Groups({"extra_fields_read", "extra_data_read"}) |
47
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
48
|
|
|
*/ |
49
|
|
|
private $id; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @ORM\Column(name="field_name", type="string", length=255, nullable=false) |
53
|
|
|
* @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"}) |
54
|
|
|
*/ |
55
|
|
|
private $name; |
56
|
|
|
/** |
57
|
|
|
* @ORM\Column(name="field_type", type="string", length=255, nullable=false) |
58
|
|
|
* @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"}) |
59
|
|
|
*/ |
60
|
|
|
private $type; |
61
|
|
|
/** |
62
|
|
|
* @ORM\Column(name="context", type="string", length=255, nullable=false) |
63
|
|
|
* @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"}) |
64
|
|
|
*/ |
65
|
|
|
private $context; |
66
|
|
|
/** |
67
|
|
|
* @ORM\Column(name="required", type="boolean", nullable=true) |
68
|
|
|
* @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"}) |
69
|
|
|
*/ |
70
|
|
|
private $required; |
71
|
|
|
/** |
72
|
|
|
* @ORM\Column(name="field_configs", type="string", nullable=true) |
73
|
|
|
* @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"}) |
74
|
|
|
*/ |
75
|
|
|
private $configs; |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get the value of id |
80
|
|
|
*/ |
81
|
|
|
public function getId() |
82
|
|
|
{ |
83
|
|
|
return $this->id; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Get the value of name |
88
|
|
|
*/ |
89
|
|
|
public function getName() |
90
|
|
|
{ |
91
|
|
|
return $this->name; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Set the value of name |
96
|
|
|
*/ |
97
|
|
|
public function setName($name): self |
98
|
|
|
{ |
99
|
|
|
$this->name = $name; |
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Get the value of type |
106
|
|
|
*/ |
107
|
|
|
public function getType() |
108
|
|
|
{ |
109
|
|
|
return $this->type; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set the value of type |
114
|
|
|
*/ |
115
|
|
|
public function setType($type): self |
116
|
|
|
{ |
117
|
|
|
$this->type = $type; |
118
|
|
|
|
119
|
|
|
return $this; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get the value of context |
124
|
|
|
*/ |
125
|
|
|
public function getContext() |
126
|
|
|
{ |
127
|
|
|
return $this->context; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Set the value of context |
132
|
|
|
*/ |
133
|
|
|
public function setContext($context): self |
134
|
|
|
{ |
135
|
|
|
$this->context = $context; |
136
|
|
|
|
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Get the value of required |
142
|
|
|
*/ |
143
|
|
|
public function getRequired() |
144
|
|
|
{ |
145
|
|
|
return $this->required; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Set the value of required |
150
|
|
|
*/ |
151
|
|
|
public function setRequired($required): self |
152
|
|
|
{ |
153
|
|
|
$this->required = $required; |
154
|
|
|
|
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Get the value of configs |
160
|
|
|
*/ |
161
|
|
|
public function getConfigs() |
162
|
|
|
{ |
163
|
|
|
return $this->configs; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Set the value of configs |
168
|
|
|
*/ |
169
|
|
|
public function setConfigs($configs): self |
170
|
|
|
{ |
171
|
|
|
$this->configs = $configs; |
172
|
|
|
|
173
|
|
|
return $this; |
174
|
|
|
} |
175
|
|
|
} |
176
|
|
|
|
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