1 | <?php |
||
16 | class Role |
||
17 | { |
||
18 | /** |
||
19 | * @var int |
||
20 | * |
||
21 | * @ORM\Column(name="id", type="integer") |
||
22 | * @ORM\Id |
||
23 | * @ORM\GeneratedValue(strategy="AUTO") |
||
24 | */ |
||
25 | private $id; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | * |
||
30 | * @ORM\Column(name="name", type="string", length=50) |
||
31 | * |
||
32 | * @Assert\NotBlank() |
||
33 | * @Assert\Length(max = 50) |
||
34 | */ |
||
35 | private $name; |
||
36 | |||
37 | /** |
||
38 | * @ORM\OneToMany(targetEntity="User", mappedBy="role") |
||
39 | */ |
||
40 | private $users; |
||
41 | |||
42 | /** |
||
43 | * Get id |
||
44 | * |
||
45 | * @return int |
||
46 | */ |
||
47 | public function getId() |
||
51 | |||
52 | /** |
||
53 | * Set name |
||
54 | * |
||
55 | * @param string $name |
||
56 | * |
||
57 | * @return Role |
||
58 | */ |
||
59 | public function setName($name) |
||
65 | |||
66 | /** |
||
67 | * Get name |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function getName() |
||
75 | |||
76 | /** |
||
77 | * Constructor |
||
78 | */ |
||
79 | public function __construct() |
||
83 | |||
84 | /** |
||
85 | * Add user |
||
86 | * |
||
87 | * @param \AppBundle\Entity\User $user |
||
88 | * |
||
89 | * @return Role |
||
90 | */ |
||
91 | public function addUser(User $user) |
||
97 | |||
98 | /** |
||
99 | * Remove user |
||
100 | * |
||
101 | * @param \AppBundle\Entity\User $user |
||
102 | */ |
||
103 | public function removeUser(User $user) |
||
107 | |||
108 | /** |
||
109 | * Get users |
||
110 | * |
||
111 | * @return \Doctrine\Common\Collections\Collection |
||
112 | */ |
||
113 | public function getUsers() |
||
117 | } |
||
118 |