1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Entity; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Repository\PermissionRelRoleRepository; |
10
|
|
|
use DateTime; |
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
12
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
13
|
|
|
|
14
|
|
|
#[ORM\Entity(repositoryClass: PermissionRelRoleRepository::class)] |
15
|
|
|
#[ORM\Table(name: 'permission_rel_role')] |
16
|
|
|
/** |
17
|
|
|
* The PermissionRelRole entity makes the link between roles |
18
|
|
|
* (defined in security.yaml) and permissions (defined by the |
19
|
|
|
* Permission entity) to define which user role can do what. |
20
|
|
|
*/ |
21
|
|
|
class PermissionRelRole |
22
|
|
|
{ |
23
|
|
|
#[ORM\Id] |
24
|
|
|
#[ORM\GeneratedValue(strategy: 'AUTO')] |
25
|
|
|
#[ORM\Column(type: 'integer')] |
26
|
|
|
private ?int $id = null; |
27
|
|
|
|
28
|
|
|
#[ORM\ManyToOne(targetEntity: Permission::class)] |
29
|
|
|
#[ORM\JoinColumn(nullable: false)] |
30
|
|
|
private Permission $permission; |
31
|
|
|
|
32
|
|
|
#[ORM\ManyToOne(targetEntity: Role::class)] |
33
|
|
|
#[ORM\JoinColumn(nullable: false)] |
34
|
|
|
private Role $role; |
35
|
|
|
|
36
|
|
|
#[ORM\Column(type: 'boolean')] |
37
|
|
|
private bool $changeable; |
38
|
|
|
|
39
|
|
|
#[ORM\Column(type: 'datetime')] |
40
|
|
|
private DateTime $updatedAt; |
41
|
|
|
|
42
|
|
|
public function getId(): ?int |
43
|
|
|
{ |
44
|
|
|
return $this->id; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function getPermission(): Permission |
48
|
|
|
{ |
49
|
|
|
return $this->permission; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function setPermission(Permission $permission): self |
53
|
|
|
{ |
54
|
|
|
$this->permission = $permission; |
55
|
|
|
|
56
|
|
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getRole(): Role |
60
|
|
|
{ |
61
|
|
|
return $this->role; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setRole(Role $role): self |
65
|
|
|
{ |
66
|
|
|
$this->role = $role; |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function isChangeable(): bool |
72
|
|
|
{ |
73
|
|
|
return $this->changeable; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function setChangeable(bool $changeable): self |
77
|
|
|
{ |
78
|
|
|
$this->changeable = $changeable; |
79
|
|
|
|
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getUpdatedAt(): DateTime |
84
|
|
|
{ |
85
|
|
|
return $this->updatedAt; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function setUpdatedAt(DateTime $updatedAt): self |
89
|
|
|
{ |
90
|
|
|
$this->updatedAt = $updatedAt; |
91
|
|
|
|
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|