Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

src/Kunstmaan/AdminBundle/Entity/Role.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\AdminBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
7
use Symfony\Component\Security\Core\Role\Role as BaseRole;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * Role Entity
12
 *
13
 * @ORM\Entity
14
 * @ORM\Table( name="kuma_roles" )
15
 * @UniqueEntity("role")
16
 */
17
class Role extends BaseRole
18
{
19
    /**
20
     * @ORM\Id
21
     * @ORM\Column(type="integer", name="id")
22
     * @ORM\GeneratedValue(strategy="AUTO")
23
     */
24
    protected $id;
25
26
    /**
27
     * @Assert\NotBlank()
28
     * @ORM\Column(type="string", name="role", unique=true, length=70)
29
     */
30
    protected $role;
31
32
    /**
33
     * Populate the role field
34
     *
35
     * @param string $role
36
     */
37 5
    public function __construct($role)
38
    {
39 5
        $this->role = $role;
40 5
    }
41
42
    /**
43
     * Return the role field.
44
     *
45
     * @return string
46
     */
47 3
    public function getRole()
48
    {
49 3
        return $this->role;
50
    }
51
52
    /**
53
     * Return the string representation of the role entity.
54
     */
55 1
    public function __toString(): string
56
    {
57 1
        return (string) $this->role;
58
    }
59
60
    /**
61
     * Get id
62
     *
63
     * @return int
64
     */
65 1
    public function getId()
66
    {
67 1
        return $this->id;
68
    }
69
70
    /**
71
     * Modify the role field.
72
     *
73
     * @param string $role ROLE_FOO etc
74
     *
75
     * @return RoleInterface
0 ignored issues
show
Should the return type not be Role?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
76
     */
77 1
    public function setRole($role)
78
    {
79 1
        $this->role = $role;
80
81 1
        return $this;
82
    }
83
}
84