Completed
Push — master ( ae5e03...0447ee )
by Jeroen
10:35 queued 04:37
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
     * @return string
56
     */
57 1
    public function __toString(): string
58
    {
59 1
        return (string) $this->role;
60
    }
61
62
    /**
63
     * Get id
64
     *
65
     * @return int
66
     */
67 1
    public function getId()
68
    {
69 1
        return $this->id;
70
    }
71
72
    /**
73
     * Modify the role field.
74
     *
75
     * @param string $role ROLE_FOO etc
76
     *
77
     * @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...
78
     */
79 1
    public function setRole($role)
80
    {
81 1
        $this->role = $role;
82
83 1
        return $this;
84
    }
85
}
86