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\Metadata\ApiFilter; |
|
|
|
|
10
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
11
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
12
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
19
|
|
|
* @ORM\Table (name="extra_data") |
20
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\ExtraDataRepository") |
21
|
|
|
*/ |
22
|
|
|
#[ApiResource( |
23
|
|
|
operations: [ |
24
|
|
|
new Get(uriTemplate: '/extra_data/{id}', security: 'is_granted(\'ROLE_CLIENT\')'), |
25
|
|
|
new GetCollection(uriTemplate: '/extra_data', security: 'is_granted(\'ROLE_CLIENT\')'), |
26
|
|
|
new Put( |
27
|
|
|
uriTemplate: '/extra_data/{id}', |
28
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
29
|
|
|
validationContext: ['groups' => ['extra_data_write']], |
30
|
|
|
denormalizationContext: ['groups' => ['extra_data_write']] |
31
|
|
|
), |
32
|
|
|
new Delete(uriTemplate: '/extra_data/{id}', security: 'is_granted(\'ROLE_CLIENT\')'), |
33
|
|
|
new Post(uriTemplate: '/extra_data', securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
34
|
|
|
], |
35
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => |
36
|
|
|
['text/csv']], |
37
|
|
|
normalizationContext: ['groups' => ['extra_data_read']], |
38
|
|
|
denormalizationContext: ['groups' => ['extra_data_write']] |
39
|
|
|
)] |
40
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact', 'type' => 'exact', 'people' => 'exact'])] |
41
|
|
|
|
42
|
|
|
class ExtraData |
43
|
|
|
{ |
44
|
|
|
/** |
45
|
|
|
* @var integer |
46
|
|
|
* |
47
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
48
|
|
|
* @ORM\Id |
49
|
|
|
* @Groups({"extrafields_read", "extra_data_read"}) |
50
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
51
|
|
|
*/ |
52
|
|
|
private $id; |
53
|
|
|
/** |
54
|
|
|
* @var \ControleOnline\Entity\ExtraFields |
55
|
|
|
* |
56
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\ExtraFields") |
57
|
|
|
* @ORM\JoinColumns({ |
58
|
|
|
* @ORM\JoinColumn(name="extra_fields_id", referencedColumnName="id") |
59
|
|
|
* }) |
60
|
|
|
* @Groups({"extra_data_read"}) |
61
|
|
|
*/ |
62
|
|
|
private $extra_fields; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @ORM\Column(name="entity_id", type="string", nullable=false) |
66
|
|
|
* @Groups({"extra_data_read"}) |
67
|
|
|
*/ |
68
|
|
|
private $entity_id; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @ORM\Column(name="entity_name", type="string", nullable=false) |
72
|
|
|
* @Groups({"extra_data_read"}) |
73
|
|
|
*/ |
74
|
|
|
private $entity_name; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @ORM\Column(name="data_value", type="string", nullable=false) |
78
|
|
|
* @Groups({"extra_data_read"}) |
79
|
|
|
*/ |
80
|
|
|
private $value; |
81
|
|
|
/** |
82
|
|
|
* Constructor |
83
|
|
|
*/ |
84
|
|
|
public function __construct() |
85
|
|
|
{ |
86
|
|
|
} |
87
|
|
|
/** |
88
|
|
|
* Get id |
89
|
|
|
* |
90
|
|
|
* @return integer |
91
|
|
|
*/ |
92
|
|
|
public function getId() |
93
|
|
|
{ |
94
|
|
|
return $this->id; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
public function setValue($value): self |
99
|
|
|
{ |
100
|
|
|
$this->value = $value; |
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
public function getValue() |
104
|
|
|
{ |
105
|
|
|
return $this->value; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Get the value of entity_id |
110
|
|
|
*/ |
111
|
|
|
public function getEntityId() |
112
|
|
|
{ |
113
|
|
|
return $this->entity_id; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Set the value of entity_id |
118
|
|
|
*/ |
119
|
|
|
public function setEntityId($entity_id): self |
120
|
|
|
{ |
121
|
|
|
$this->entity_id = $entity_id; |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Get the value of entity_name |
128
|
|
|
*/ |
129
|
|
|
public function getEntityName() |
130
|
|
|
{ |
131
|
|
|
return $this->entity_name; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Set the value of entity_name |
136
|
|
|
*/ |
137
|
|
|
public function setEntityName($entity_name): self |
138
|
|
|
{ |
139
|
|
|
$this->entity_name = $entity_name; |
140
|
|
|
|
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Get the value of extra_fields |
146
|
|
|
*/ |
147
|
|
|
public function getExtraFields() |
148
|
|
|
{ |
149
|
|
|
return $this->extra_fields; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Set the value of extra_fields |
154
|
|
|
*/ |
155
|
|
|
public function setExtraFields($extra_fields): self |
156
|
|
|
{ |
157
|
|
|
$this->extra_fields = $extra_fields; |
158
|
|
|
|
159
|
|
|
return $this; |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|
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