Routes::setId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 2
c 3
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use Symfony\Component\Serializer\Attribute\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Attribute\Groups was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\SearchFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use ApiPlatform\Metadata\ApiFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use ApiPlatform\Metadata\Delete;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Delete was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use ApiPlatform\Metadata\Get;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use ApiPlatform\Metadata\Post;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Post was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use ApiPlatform\Metadata\Put;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Put was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use ControleOnline\Listener\LogListener;
16
use ControleOnline\Repository\RouteRepository;
17
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
}