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 $field_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 $field_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 $field_configs; |
76
|
|
|
/** |
77
|
|
|
* Constructor |
78
|
|
|
*/ |
79
|
|
|
public function __construct() |
80
|
|
|
{ |
81
|
|
|
} |
82
|
|
|
/** |
83
|
|
|
* Get id |
84
|
|
|
* |
85
|
|
|
* @return integer |
86
|
|
|
*/ |
87
|
|
|
public function getId() |
88
|
|
|
{ |
89
|
|
|
return $this->id; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function setFieldName($value): self |
93
|
|
|
{ |
94
|
|
|
$this->field_name = $value; |
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
public function getFieldName() |
98
|
|
|
{ |
99
|
|
|
return $this->field_name; |
100
|
|
|
} |
101
|
|
|
public function setFieldType($value): self |
102
|
|
|
{ |
103
|
|
|
$this->field_type = $value; |
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
public function getFieldType() |
107
|
|
|
{ |
108
|
|
|
return $this->field_type; |
109
|
|
|
} |
110
|
|
|
public function setContext($value): self |
111
|
|
|
{ |
112
|
|
|
$this->context = $value; |
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
public function getContext() |
116
|
|
|
{ |
117
|
|
|
return $this->context; |
118
|
|
|
} |
119
|
|
|
public function setRequired($value): self |
120
|
|
|
{ |
121
|
|
|
$this->required = $value; |
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
public function getRequired() |
125
|
|
|
{ |
126
|
|
|
return $this->required; |
127
|
|
|
} |
128
|
|
|
public function setFieldConfigs($value): self |
129
|
|
|
{ |
130
|
|
|
$this->field_configs = $value; |
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
public function getFieldConfigs() |
134
|
|
|
{ |
135
|
|
|
return $this->field_configs; |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
|
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