zend-blog-3-backend
326 строк · 6.1 Кб
1<?php
2
3namespace App\Entity;
4
5use DateTime;
6use Doctrine\ORM\Mapping as ORM;
7
8/**
9* @ORM\Table(uniqueConstraints={
10* @ORM\UniqueConstraint(columns={"external_id", "data_provider"})
11* })
12* @ORM\Entity(repositoryClass="App\Repository\UserExtraInfoRepository")
13*/
14class UserExtraInfo
15{
16public const MALE = 1;
17public const FEMALE = 2;
18public const UNKNOWN = 3;
19
20/**
21* @var int
22*
23* @ORM\Id
24* @ORM\Column(type="integer")
25* @ORM\GeneratedValue(strategy="AUTO")
26*/
27private $id;
28
29/**
30* @var string
31*
32* @ORM\Column(type="string", length=64)
33*/
34private $externalId;
35
36/**
37* @var string
38*
39* @ORM\Column(type="string", length=16)
40*/
41private $dataProvider;
42
43/**
44* @var User
45*
46* @ORM\ManyToOne(targetEntity="App\Entity\User")
47* @ORM\JoinColumn(nullable=false)
48*/
49protected $user;
50
51/**
52* @var string|null
53*
54* @ORM\Column(type="string", length=64, nullable=true)
55*/
56private $username;
57
58/**
59* @var string|null
60*
61* @ORM\Column(type="string", length=64, nullable=true)
62*/
63private $displayName;
64
65/**
66* @var string|null
67*
68* @ORM\Column(type="string", length=64, nullable=true)
69*/
70private $firstName;
71
72/**
73* @var string|null
74*
75* @ORM\Column(type="string", length=64, nullable=true)
76*/
77private $lastName;
78
79/**
80* @var int
81*
82* @ORM\Column(type="smallint", options={"default": 3, "comment":"1: male, 2: female, 3: n/a"})
83*/
84private $gender = self::UNKNOWN;
85
86/**
87* @var string|null
88*
89* @ORM\Column(type="string", length=64, nullable=true)
90*/
91private $email;
92
93/**
94* @var string|null
95*
96* @ORM\Column(type="text", length=65535, nullable=true)
97*/
98private $avatar;
99
100/**
101* @var string
102*
103* @ORM\Column(type="text", length=65535)
104*/
105private $rawData;
106
107/**
108* @var DateTime
109*
110* @ORM\Column(type="milliseconds_dt", options={"default": "CURRENT_TIMESTAMP(3)"})
111*/
112private $timeCreated;
113
114/**
115* @var TrackingAgent|null
116*
117* @ORM\ManyToOne(targetEntity="App\Entity\TrackingAgent")
118* @ORM\JoinColumn(name="user_agent_id", referencedColumnName="id", onDelete="SET NULL")
119*/
120protected $trackingAgent;
121
122/**
123* @var string|null
124*
125* @ORM\Column(name="ip_addr", type="string", length=15, nullable=true)
126*/
127protected $ipAddress;
128
129/**
130* @var GeoLocation|null
131*
132* @ORM\ManyToOne(targetEntity="App\Entity\GeoLocation")
133* @ORM\JoinColumn(name="ip_long", referencedColumnName="ip_long", onDelete="SET NULL")
134*/
135private $geoLocation;
136
137public function __construct()
138{
139$this->timeCreated = new DateTime();
140}
141
142public function getId(): ?int
143{
144return $this->id;
145}
146
147public function getExternalId(): string
148{
149return $this->externalId;
150}
151
152public function setExternalId(string $externalId): self
153{
154$this->externalId = $externalId;
155
156return $this;
157}
158
159public function getDataProvider(): string
160{
161return $this->dataProvider;
162}
163
164public function setDataProvider(string $dataProvider): self
165{
166$this->dataProvider = $dataProvider;
167
168return $this;
169}
170
171public function getUser(): User
172{
173return $this->user;
174}
175
176public function setUser(User $user): self
177{
178$this->user = $user;
179
180return $this;
181}
182
183public function getUsername(): ?string
184{
185return $this->username;
186}
187
188public function setUsername(?string $username): self
189{
190$this->username = $username;
191
192return $this;
193}
194
195public function getDisplayName(): ?string
196{
197return $this->displayName;
198}
199
200public function setDisplayName(?string $displayName): self
201{
202$this->displayName = $displayName;
203
204return $this;
205}
206
207public function getFirstName(): ?string
208{
209return $this->firstName;
210}
211
212public function setFirstName(?string $firstName): self
213{
214$this->firstName = $firstName;
215
216return $this;
217}
218
219public function getLastName(): ?string
220{
221return $this->lastName;
222}
223
224public function setLastName(?string $lastName): self
225{
226$this->lastName = $lastName;
227
228return $this;
229}
230
231public function getGender(): int
232{
233return $this->gender;
234}
235
236public function setGender(int $gender): self
237{
238$this->gender = $gender;
239
240return $this;
241}
242
243public function getEmail(): ?string
244{
245return $this->email;
246}
247
248public function setEmail(?string $email): self
249{
250$this->email = $email;
251
252return $this;
253}
254
255public function getAvatar(): ?string
256{
257return $this->avatar;
258}
259
260public function setAvatar(?string $avatar): self
261{
262$this->avatar = $avatar;
263
264return $this;
265}
266
267public function getRawData(): string
268{
269return $this->rawData;
270}
271
272public function setRawData(string $rawData): self
273{
274$this->rawData = $rawData;
275
276return $this;
277}
278
279public function getTimeCreated(): DateTime
280{
281return $this->timeCreated;
282}
283
284public function setTimeCreated(DateTime $timeCreated): self
285{
286$this->timeCreated = $timeCreated;
287
288return $this;
289}
290
291public function getTrackingAgent(): ?TrackingAgent
292{
293return $this->trackingAgent;
294}
295
296public function setTrackingAgent(TrackingAgent $trackingAgent = null): self
297{
298$this->trackingAgent = $trackingAgent;
299
300return $this;
301}
302
303public function getIpAddress(): string
304{
305return $this->ipAddress;
306}
307
308public function setIpAddress(string $ipAddress): self
309{
310$this->ipAddress = $ipAddress;
311
312return $this;
313}
314
315public function getGeoLocation(): ?GeoLocation
316{
317return $this->geoLocation;
318}
319
320public function setGeoLocation(GeoLocation $geoLocation = null): self
321{
322$this->geoLocation = $geoLocation;
323
324return $this;
325}
326}
327