1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace App\Users\Entity; |
5
|
|
|
|
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity |
12
|
|
|
* @ORM\Table(name="users_profiles") |
13
|
|
|
*/ |
14
|
|
|
class UserProfile |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @ORM\Id() |
18
|
|
|
* @ORM\GeneratedValue() |
19
|
|
|
* @ORM\Column(type="integer") |
20
|
|
|
*/ |
21
|
|
|
private $id; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var $contacts UserProfileContacts[]|ArrayCollection |
25
|
|
|
* @ORM\OneToMany(targetEntity="App\Users\Entity\UserProfileContacts", mappedBy="profile", cascade={"persist", "remove"}) |
26
|
|
|
* @ORM\JoinColumn(nullable=true) |
27
|
|
|
* @Groups({"view"}) |
28
|
|
|
*/ |
29
|
|
|
private $contacts; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @ORM\Column(type="string", length=255, nullable=true) |
33
|
|
|
* @Groups({"list", "view"}) |
34
|
|
|
*/ |
35
|
|
|
private $first_name; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @ORM\Column(type="string", length=255, nullable=true) |
39
|
|
|
* @Groups({"list", "view"}) |
40
|
|
|
*/ |
41
|
|
|
private $last_name; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @ORM\Column(type="date", nullable=true) |
45
|
|
|
* @Groups({"view"}) |
46
|
|
|
*/ |
47
|
|
|
private $birth_date; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @ORM\Column(type="string", length=255, nullable=true) |
51
|
|
|
* @Groups({"view"}) |
52
|
|
|
*/ |
53
|
|
|
private $about; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @ORM\Column(type="string", length=255, nullable=true) |
57
|
|
|
* @Groups({"view"}) |
58
|
|
|
*/ |
59
|
|
|
private $public_email; |
60
|
|
|
|
61
|
31 |
|
public function __construct() |
62
|
|
|
{ |
63
|
31 |
|
$this->contacts = new ArrayCollection(); |
64
|
31 |
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return mixed |
68
|
|
|
*/ |
69
|
4 |
|
public function getFirstName() |
70
|
|
|
{ |
71
|
4 |
|
return $this->first_name; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param mixed $first_name |
76
|
|
|
* @return UserProfile |
77
|
|
|
*/ |
78
|
|
|
public function setFirstName($first_name) |
79
|
|
|
{ |
80
|
|
|
$this->first_name = $first_name; |
81
|
|
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return mixed |
86
|
|
|
*/ |
87
|
4 |
|
public function getLastName() |
88
|
|
|
{ |
89
|
4 |
|
return $this->last_name; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param mixed $last_name |
94
|
|
|
* @return UserProfile |
95
|
|
|
*/ |
96
|
|
|
public function setLastName($last_name) |
97
|
|
|
{ |
98
|
|
|
$this->last_name = $last_name; |
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return mixed |
104
|
|
|
*/ |
105
|
3 |
|
public function getAbout() |
106
|
|
|
{ |
107
|
3 |
|
return $this->about; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param mixed $about |
112
|
|
|
* @return UserProfile |
113
|
|
|
*/ |
114
|
|
|
public function setAbout($about) |
115
|
|
|
{ |
116
|
|
|
$this->about = $about; |
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return mixed |
122
|
|
|
*/ |
123
|
3 |
|
public function getPublicEmail() |
124
|
|
|
{ |
125
|
3 |
|
return $this->public_email; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param mixed $public_email |
130
|
|
|
* @return UserProfile |
131
|
|
|
*/ |
132
|
|
|
public function setPublicEmail($public_email) |
133
|
|
|
{ |
134
|
|
|
$this->public_email = $public_email; |
135
|
|
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return mixed |
140
|
|
|
*/ |
141
|
1 |
|
public function getId() |
142
|
|
|
{ |
143
|
1 |
|
return $this->id; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return mixed |
148
|
|
|
*/ |
149
|
5 |
|
public function getBirthDate() |
150
|
|
|
{ |
151
|
5 |
|
return $this->birth_date; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param \DateTime $birth_date |
156
|
|
|
* @return UserProfile |
157
|
|
|
*/ |
158
|
1 |
|
public function setBirthDate(\DateTime $birth_date) |
159
|
|
|
{ |
160
|
1 |
|
$this->birth_date = $birth_date; |
161
|
1 |
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return UserProfileContacts[]|ArrayCollection |
166
|
|
|
*/ |
167
|
5 |
|
public function getContacts() |
168
|
|
|
{ |
169
|
5 |
|
return $this->contacts->toArray(); |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param $name |
174
|
|
|
* @param $url |
175
|
|
|
* @return $this |
176
|
|
|
*/ |
177
|
1 |
|
public function addContacts($name, $url) |
178
|
|
|
{ |
179
|
1 |
|
$contact = new UserProfileContacts($this, $name, $url); |
180
|
1 |
|
$this->contacts->add($contact); |
181
|
1 |
|
return $this; |
182
|
|
|
} |
183
|
|
|
} |