Menu::getRoute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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\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...
8
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...
9
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...
10
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...
11
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...
12
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...
13
use ControleOnline\Controller\GetActionByPeopleAction;
14
use ControleOnline\Controller\GetMenuByPeopleAction;
15
use ControleOnline\Listener\LogListener;
16
use ControleOnline\Repository\MenuRepository;
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' => ['menu: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
        new GetCollection(
30
            uriTemplate: '/menus-people',
31
            controller: GetMenuByPeopleAction::class
32
        ),
33
        new GetCollection(
34
            uriTemplate: '/actions/people',
35
            controller: GetActionByPeopleAction::class
36
        )
37
    ],
38
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
39
    normalizationContext: ['groups' => ['menu:read']],
40
    denormalizationContext: ['groups' => ['menu:write']]
41
)]
42
#[ORM\Table(name: 'menu')]
43
#[ORM\Index(name: 'category_id', columns: ['category_id'])]
44
#[ORM\UniqueConstraint(name: 'route', columns: ['route'])]
45
#[ORM\EntityListeners([LogListener::class])]
46
#[ORM\Entity(repositoryClass: MenuRepository::class)]
47
class Menu
48
{
49
    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
50
    #[ORM\Id]
51
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
52
    #[Groups(['menu:read'])]
53
    private $id;
54
55
    #[ORM\Column(name: 'menu', type: 'string', length: 50, nullable: false)]
56
    #[Groups(['menu:read', 'menu:write'])]
57
    private $menu;
58
59
    #[ORM\JoinColumn(name: 'route_id', referencedColumnName: 'id')]
60
    #[ORM\ManyToOne(targetEntity: Routes::class)]
61
    #[Groups(['menu:read', 'menu:write'])]
62
    private $route;
63
64
    #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')]
65
    #[ORM\ManyToOne(targetEntity: Category::class)]
66
    #[Groups(['menu:read', 'menu:write'])]
67
    private $category;
68
69
    public function getId()
70
    {
71
        return $this->id;
72
    }
73
74
    public function getMenu(): string
75
    {
76
        return $this->menu;
77
    }
78
79
    public function setMenu($menu): self
80
    {
81
        $this->menu = $menu;
82
        return $this;
83
    }
84
85
    public function getRoute()
86
    {
87
        return $this->route;
88
    }
89
90
    public function setRoute($route): self
91
    {
92
        $this->route = $route;
93
        return $this;
94
    }
95
96
    public function getCategory()
97
    {
98
        return $this->category;
99
    }
100
101
    public function setCategory($category): self
102
    {
103
        $this->category = $category;
104
        return $this;
105
    }
106
}