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\Listener\LogListener; |
16
|
|
|
use ControleOnline\Repository\RouteRepository; |
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
18
|
|
|
|
19
|
|
|
#[ApiResource( |
20
|
|
|
operations: [ |
21
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))'), |
22
|
|
|
new Put( |
23
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
24
|
|
|
denormalizationContext: ['groups' => ['route:write']] |
25
|
|
|
), |
26
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
27
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
28
|
|
|
new Post(security: 'is_granted(\'ROLE_CLIENT\')'), |
29
|
|
|
], |
30
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
31
|
|
|
normalizationContext: ['groups' => ['route:read']], |
32
|
|
|
denormalizationContext: ['groups' => ['route:write']] |
33
|
|
|
)] |
34
|
|
|
#[ORM\Table(name: 'routes')] |
35
|
|
|
#[ORM\Index(name: 'module_id', columns: ['module_id'])] |
36
|
|
|
#[ORM\UniqueConstraint(name: 'route', columns: ['route'])] |
37
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
38
|
|
|
#[ORM\Entity(repositoryClass: RouteRepository::class)] |
39
|
|
|
class Routes |
40
|
|
|
{ |
41
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
42
|
|
|
#[ORM\Id] |
43
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
44
|
|
|
#[Groups(['menu:read', 'route:read'])] |
45
|
|
|
private $id; |
46
|
|
|
|
47
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['route' => 'exact'])] |
48
|
|
|
#[ORM\Column(name: 'route', type: 'string', length: 50, nullable: false)] |
49
|
|
|
#[Groups(['menu:read', 'route:read', 'route:write'])] |
50
|
|
|
private $route; |
51
|
|
|
|
52
|
|
|
#[ORM\JoinColumn(name: 'module_id', referencedColumnName: 'id')] |
53
|
|
|
#[ORM\ManyToOne(targetEntity: Module::class)] |
54
|
|
|
#[Groups(['menu:read', 'route:read', 'route:write'])] |
55
|
|
|
private $module; |
56
|
|
|
|
57
|
|
|
#[ORM\Column(name: 'color', type: 'string', length: 50, nullable: false, options: ['default' => "'\$primary'"])] |
58
|
|
|
#[Groups(['menu:read', 'route:read', 'route:write'])] |
59
|
|
|
private $color = '$primary'; |
60
|
|
|
|
61
|
|
|
#[ORM\Column(name: 'icon', type: 'string', length: 50, nullable: false)] |
62
|
|
|
#[Groups(['menu:read', 'route:read', 'route:write'])] |
63
|
|
|
private $icon; |
64
|
|
|
|
65
|
|
|
public function getId() |
66
|
|
|
{ |
67
|
|
|
return $this->id; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function setId($id): self |
71
|
|
|
{ |
72
|
|
|
$this->id = $id; |
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function getRoute() |
77
|
|
|
{ |
78
|
|
|
return $this->route; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function setRoute($route): self |
82
|
|
|
{ |
83
|
|
|
$this->route = $route; |
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getModule() |
88
|
|
|
{ |
89
|
|
|
return $this->module; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function setModule($module): self |
93
|
|
|
{ |
94
|
|
|
$this->module = $module; |
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getColor(): string |
99
|
|
|
{ |
100
|
|
|
return $this->color; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function setColor($color): self |
104
|
|
|
{ |
105
|
|
|
$this->color = $color; |
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function getIcon(): string |
110
|
|
|
{ |
111
|
|
|
return $this->icon; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function setIcon($icon): self |
115
|
|
|
{ |
116
|
|
|
$this->icon = $icon; |
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
} |
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