Completed
Push — 5.3 ( d18aef...16c32d )
by Jeroen
15:04 queued 08:59
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
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Security\Core\Role\Role has been deprecated with message: since Symfony 4.3, to be removed in 5.0. Use strings as roles instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
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
78
     */
79 1
    public function setRole($role)
80
    {
81 1
        $this->role = $role;
82
83 1
        return $this;
84
    }
85
}
86