1 | <?php declare(strict_types=1); |
||
14 | class Role implements PassportInterface |
||
15 | { |
||
16 | /** |
||
17 | * @ORM\Id |
||
18 | * @ORM\Column(type="integer") |
||
19 | * @ORM\GeneratedValue |
||
20 | * @var int $id |
||
21 | */ |
||
22 | private $id; |
||
23 | |||
24 | /** |
||
25 | * @ORM\Column(type="string",length=50) |
||
26 | * @var string $roleName |
||
27 | */ |
||
28 | private $roleName; |
||
29 | |||
30 | /** |
||
31 | * A role can have various roles under it |
||
32 | * @OneToMany(targetEntity="Role", mappedBy="parentRole") |
||
33 | * @var ArrayCollection $children |
||
34 | */ |
||
35 | private $children; |
||
36 | |||
37 | /** |
||
38 | * Many role have one parent |
||
39 | * @ManyToOne(targetEntity="Role", inversedBy="children") |
||
40 | * @JoinColumn(name="parent_id", referencedColumnName="id") |
||
41 | * @var Role $parentRole |
||
42 | */ |
||
43 | private $parentRole; |
||
44 | |||
45 | /** |
||
46 | * @return int |
||
47 | */ |
||
48 | public function getId(): int |
||
52 | |||
53 | /** |
||
54 | * @param int $id |
||
55 | */ |
||
56 | public function setId(int $id): void |
||
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getRoleName(): string |
||
68 | |||
69 | /** |
||
70 | * @param string $roleName |
||
71 | */ |
||
72 | public function setRoleName(string $roleName): void |
||
76 | |||
77 | /** |
||
78 | * @return ArrayCollection |
||
79 | */ |
||
80 | public function getChildren(): ArrayCollection |
||
84 | |||
85 | /** |
||
86 | * @param ArrayCollection $children |
||
87 | */ |
||
88 | public function setChildren(ArrayCollection $children): void |
||
92 | |||
93 | /** |
||
94 | * @return Role |
||
95 | */ |
||
96 | public function getParentRole(): Role |
||
100 | |||
101 | /** |
||
102 | * @param Role $parentRole |
||
103 | */ |
||
104 | public function setParentRole(Role $parentRole): void |
||
108 | } |
||
109 | |||
110 |