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