Completed
Push — master ( 91fdab...75a7b9 )
by
unknown
13: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
    /**
21
     * @ORM\Id
22
     * @ORM\Column(type="integer", name="id")
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    protected $id;
26
27
    /**
28
     * @Assert\NotBlank()
29
     * @ORM\Column(type="string", name="role", unique=true, length=70)
30
     */
31
    protected $role;
32
33
    /**
34
     * Populate the role field
35
     *
36
     * @param string $role
37
     */
38
    public function __construct($role)
39
    {
40
        $this->role = $role;
41
    }
42
43
    /**
44
     * Return the role field.
45
     *
46
     * @return string
47
     */
48
    public function getRole()
49
    {
50
        return $this->role;
51
    }
52
53
    /**
54
     * Return the string representation of the role entity.
55
     *
56
     * @return string
57
     */
58
    public function __toString()
59
    {
60
        return (string) $this->role;
61
    }
62
63
    /**
64
     * Get id
65
     *
66
     * @return int
67
     */
68
    public function getId()
69
    {
70
        return $this->id;
71
    }
72
73
    /**
74
     * Modify the role field.
75
     *
76
     * @param string $role ROLE_FOO etc
77
     *
78
     * @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...
79
     */
80
    public function setRole($role)
81
    {
82
        $this->role = $role;
83
84
        return $this;
85
    }
86
}
87