|
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\Traits\UserTrait; |
|
10
|
|
|
use DateTime; |
|
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* UserRelUser. |
|
15
|
|
|
* |
|
16
|
|
|
* @ORM\Table(name="user_rel_user", indexes={ |
|
17
|
|
|
* @ORM\Index(name="idx_user_rel_user__user", columns={"user_id"}), |
|
18
|
|
|
* @ORM\Index(name="idx_user_rel_user__friend_user", columns={"friend_user_id"}), |
|
19
|
|
|
* @ORM\Index(name="idx_user_rel_user__user_friend_user", columns={"user_id", "friend_user_id"}) |
|
20
|
|
|
* }) |
|
21
|
|
|
* @ORM\Entity |
|
22
|
|
|
*/ |
|
23
|
|
|
class UserRelUser |
|
24
|
|
|
{ |
|
25
|
|
|
use UserTrait; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @ORM\Column(name="id", type="bigint") |
|
29
|
|
|
* @ORM\Id |
|
30
|
|
|
* @ORM\GeneratedValue |
|
31
|
|
|
*/ |
|
32
|
|
|
protected int $id; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="userRelUsers") |
|
36
|
|
|
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") |
|
37
|
|
|
*/ |
|
38
|
|
|
protected User $user; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") |
|
42
|
|
|
* @ORM\JoinColumn(name="friend_user_id", referencedColumnName="id", onDelete="CASCADE") |
|
43
|
|
|
*/ |
|
44
|
|
|
protected User $friend; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @ORM\Column(name="relation_type", type="integer", nullable=false) |
|
48
|
|
|
*/ |
|
49
|
|
|
protected int $relationType; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @ORM\Column(name="last_edit", type="datetime", nullable=true) |
|
53
|
|
|
*/ |
|
54
|
|
|
protected ?DateTime $lastEdit = null; |
|
55
|
|
|
|
|
56
|
|
|
public function getUser(): User |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->user; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function setUser(User $user): self |
|
62
|
|
|
{ |
|
63
|
|
|
$this->user = $user; |
|
64
|
|
|
|
|
65
|
|
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function getFriend(): User |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->friend; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function setFriend(User $friend): self |
|
74
|
|
|
{ |
|
75
|
|
|
$this->friend = $friend; |
|
76
|
|
|
|
|
77
|
|
|
return $this; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function setRelationType(int $relationType): self |
|
81
|
|
|
{ |
|
82
|
|
|
$this->relationType = $relationType; |
|
83
|
|
|
|
|
84
|
|
|
return $this; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Get relationType. |
|
89
|
|
|
* |
|
90
|
|
|
* @return int |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getRelationType() |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->relationType; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function setLastEdit(DateTime $lastEdit): self |
|
98
|
|
|
{ |
|
99
|
|
|
$this->lastEdit = $lastEdit; |
|
100
|
|
|
|
|
101
|
|
|
return $this; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Get lastEdit. |
|
106
|
|
|
* |
|
107
|
|
|
* @return DateTime |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getLastEdit() |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->lastEdit; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Get id. |
|
116
|
|
|
* |
|
117
|
|
|
* @return int |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getId() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->id; |
|
122
|
|
|
} |
|
123
|
|
|
} |
|
124
|
|
|
|