Passed
Push — master ( b29bc1...457869 )
by Luiz Kim
02:18
created

Menu::getColor()   A

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 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...
6
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...
7
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...
8
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...
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\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...
11
use ControleOnline\Controller\GetActionByPeopleAction;
12
use ControleOnline\Controller\GetMenuByPeopleAction;
13
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...
14
use Symfony\Component\Serializer\Annotation\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Annotation\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...
15
16
17
/**
18
 * Menu
19
 *
20
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
21
 * @ORM\Table (name="menu", uniqueConstraints={@ORM\UniqueConstraint (name="route", columns={"route"})}, indexes={ @ORM\Index(name="category_id", columns={"category_id"})})
22
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\MenuRepository")
23
 * @ORM\Entity
24
 */
25
#[ApiResource(
26
    operations: [
27
        new Get(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))'),
28
        new Put(
29
            security: 'is_granted(\'ROLE_CLIENT\')',
30
            denormalizationContext: ['groups' => ['menu_write']]
31
        ),
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 GetCollection(
36
            uriTemplate: '/menus-people',
37
            controller: GetMenuByPeopleAction::class
38
        ),
39
        new GetCollection(
40
            uriTemplate: '/actions/people',
41
            controller: GetActionByPeopleAction::class
42
        )
43
    ],
44
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
45
    normalizationContext: ['groups' => ['menu_read']],
46
    denormalizationContext: ['groups' => ['menu_write']]
47
)]
48
class Menu
49
{
50
    /**
51
     * @var int
52
     *
53
     * @ORM\Column(name="id", type="integer", nullable=false)
54
     * @ORM\Id
55
     * @ORM\GeneratedValue(strategy="IDENTITY")
56
     * @Groups({"menu_read"})  
57
     */
58
    private $id;
59
    /**
60
     * @var string
61
     *
62
     * @ORM\Column(name="menu", type="string", length=50, nullable=false)
63
     * @Groups({"menu_read","menu_write"}) 
64
     */
65
    private $menu;
66
    /**
67
     * @var \Route
0 ignored issues
show
Bug introduced by
The type Route 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...
68
     *
69
     * @ORM\ManyToOne(targetEntity="Routes")
70
     * @ORM\JoinColumns({
71
     *   @ORM\JoinColumn(name="route_id", referencedColumnName="id")
72
     * })
73
     * @Groups({"menu_read","menu_write"})  
74
     */
75
    private $route;
76
77
78
    /**
79
     * @var \ControleOnline\Entity\Category
80
     *
81
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Category")
82
     * @ORM\JoinColumns({
83
     *   @ORM\JoinColumn(name="category_id", referencedColumnName="id")
84
     * })
85
     * @Groups({"menu_read","menu_write"}) 
86
     */
87
    private $category;
88
    /**
89
     * Get the value of id
90
     */
91
    public function getId(): int
92
    {
93
        return $this->id;
94
    }
95
    /**
96
     * Get the value of menu
97
     */
98
    public function getMenu(): string
99
    {
100
        return $this->menu;
101
    }
102
    /**
103
     * Set the value of menu
104
     */
105
    public function setMenu($menu): self
106
    {
107
        $this->menu = $menu;
108
        return $this;
109
    }
110
    /**
111
     * Get the value of route
112
     */
113
    public function getRoute()
114
    {
115
        return $this->route;
116
    }
117
    /**
118
     * Set the value of route
119
     */
120
    public function setRoute($route): self
121
    {
122
        $this->route = $route;
123
        return $this;
124
    }
125
126
    /**
127
     * Get the value of category
128
     */
129
    public function getCategory()
130
    {
131
        return $this->category;
132
    }
133
    /**
134
     * Set the value of category
135
     */
136
    public function setCategory($category): self
137
    {
138
        $this->category = $category;
139
        return $this;
140
    }
141
}
142