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\Controller\AddAppConfigAction; |
16
|
|
|
use ControleOnline\Controller\DiscoveryMainConfigsAction; |
17
|
|
|
use ControleOnline\Listener\LogListener; |
18
|
|
|
use ControleOnline\Repository\ConfigRepository; |
19
|
|
|
use Doctrine\ORM\Mapping\Column; |
|
|
|
|
20
|
|
|
use Doctrine\ORM\Mapping\Entity; |
|
|
|
|
21
|
|
|
use Doctrine\ORM\Mapping\EntityListeners; |
|
|
|
|
22
|
|
|
use Doctrine\ORM\Mapping\GeneratedValue; |
|
|
|
|
23
|
|
|
use Doctrine\ORM\Mapping\Id; |
|
|
|
|
24
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
|
|
|
|
25
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
|
|
|
26
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
|
|
|
27
|
|
|
use Doctrine\ORM\Mapping\UniqueConstraint; |
|
|
|
|
28
|
|
|
|
29
|
|
|
#[ApiResource( |
30
|
|
|
operations: [ |
31
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
32
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
33
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
34
|
|
|
new Post(security: 'is_granted(\'ROLE_CLIENT\')'), |
35
|
|
|
new Post( |
36
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
37
|
|
|
uriTemplate: '/configs/add-configs', |
38
|
|
|
controller: AddAppConfigAction::class |
39
|
|
|
), |
40
|
|
|
new Post( |
41
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
42
|
|
|
uriTemplate: '/configs/discovery-configs', |
43
|
|
|
controller: DiscoveryMainConfigsAction::class |
44
|
|
|
), |
45
|
|
|
new Put( |
46
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
47
|
|
|
denormalizationContext: ['groups' => ['config:write']] |
48
|
|
|
), |
49
|
|
|
], |
50
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
51
|
|
|
normalizationContext: ['groups' => ['config:read']], |
52
|
|
|
denormalizationContext: ['groups' => ['config:write']] |
53
|
|
|
)] |
54
|
|
|
#[Table(name: 'config')] |
55
|
|
|
#[UniqueConstraint(name: 'people_id', columns: ['people_id', 'configKey'])] |
56
|
|
|
#[EntityListeners([LogListener::class])] |
57
|
|
|
#[Entity(repositoryClass: ConfigRepository::class)] |
58
|
|
|
class Config |
59
|
|
|
{ |
60
|
|
|
#[Groups(['config:read'])] |
61
|
|
|
#[Column(name: 'id', type: 'integer', nullable: false)] |
62
|
|
|
#[Id] |
63
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
64
|
|
|
private int $id = 0; |
65
|
|
|
|
66
|
|
|
#[Groups(['config:read', 'config:write'])] |
67
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
68
|
|
|
#[JoinColumn(name: 'people_id', referencedColumnName: 'id')] |
69
|
|
|
#[ManyToOne(targetEntity: People::class)] |
70
|
|
|
private ?People $people = null; |
|
|
|
|
71
|
|
|
|
72
|
|
|
#[Groups(['config:read', 'config:write'])] |
73
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['configKey' => 'exact'])] |
74
|
|
|
#[Column(name: 'config_key', type: 'string', length: 255, nullable: false)] |
75
|
|
|
private string $configKey; |
76
|
|
|
|
77
|
|
|
#[Groups(['config:read', 'config:write'])] |
78
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['visibility' => 'exact'])] |
79
|
|
|
#[Column(name: 'visibility', type: 'string', length: 255, nullable: false)] |
80
|
|
|
private string $visibility; |
81
|
|
|
|
82
|
|
|
#[Groups(['config:read', 'config:write'])] |
83
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['configValue' => 'exact'])] |
84
|
|
|
#[Column(name: 'config_value', type: 'string', length: 255, nullable: false)] |
85
|
|
|
private string $configValue; |
86
|
|
|
|
87
|
|
|
#[Groups(['config:read', 'config:write'])] |
88
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['module' => 'exact'])] |
89
|
|
|
#[JoinColumn(name: 'module_id', referencedColumnName: 'id')] |
90
|
|
|
#[ManyToOne(targetEntity: Module::class)] |
91
|
|
|
private ?Module $module = null; |
92
|
|
|
|
93
|
|
|
public function getId(): int |
94
|
|
|
{ |
95
|
|
|
return $this->id; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function setPeople(?People $people): self |
99
|
|
|
{ |
100
|
|
|
$this->people = $people; |
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getPeople(): ?People |
105
|
|
|
{ |
106
|
|
|
return $this->people; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function setConfigKey(string $configKey): self |
110
|
|
|
{ |
111
|
|
|
$this->configKey = $configKey; |
112
|
|
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function getConfigKey(): string |
116
|
|
|
{ |
117
|
|
|
return $this->configKey; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function setVisibility(string $visibility): self |
121
|
|
|
{ |
122
|
|
|
$this->visibility = $visibility; |
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public function getVisibility(): string |
127
|
|
|
{ |
128
|
|
|
return $this->visibility; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function setConfigValue(string $configValue): self |
132
|
|
|
{ |
133
|
|
|
$this->configValue = $configValue; |
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function getConfigValue(): string |
138
|
|
|
{ |
139
|
|
|
return $this->configValue; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function getModule(): ?Module |
143
|
|
|
{ |
144
|
|
|
return $this->module; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function setModule(?Module $module): self |
148
|
|
|
{ |
149
|
|
|
$this->module = $module; |
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