zend-blog-3-backend

Форк
0
/
UserExtraInfo.php 
326 строк · 6.1 Кб
1
<?php
2

3
namespace App\Entity;
4

5
use DateTime;
6
use 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
 */
14
class UserExtraInfo
15
{
16
    public const MALE = 1;
17
    public const FEMALE = 2;
18
    public const UNKNOWN = 3;
19

20
    /**
21
     * @var int
22
     *
23
     * @ORM\Id
24
     * @ORM\Column(type="integer")
25
     * @ORM\GeneratedValue(strategy="AUTO")
26
     */
27
    private $id;
28

29
    /**
30
     * @var string
31
     *
32
     * @ORM\Column(type="string", length=64)
33
     */
34
    private $externalId;
35

36
    /**
37
     * @var string
38
     *
39
     * @ORM\Column(type="string", length=16)
40
     */
41
    private $dataProvider;
42

43
    /**
44
     * @var User
45
     *
46
     * @ORM\ManyToOne(targetEntity="App\Entity\User")
47
     * @ORM\JoinColumn(nullable=false)
48
     */
49
    protected $user;
50

51
    /**
52
     * @var string|null
53
     *
54
     * @ORM\Column(type="string", length=64, nullable=true)
55
     */
56
    private $username;
57

58
    /**
59
     * @var string|null
60
     *
61
     * @ORM\Column(type="string", length=64, nullable=true)
62
     */
63
    private $displayName;
64

65
    /**
66
     * @var string|null
67
     *
68
     * @ORM\Column(type="string", length=64, nullable=true)
69
     */
70
    private $firstName;
71

72
    /**
73
     * @var string|null
74
     *
75
     * @ORM\Column(type="string", length=64, nullable=true)
76
     */
77
    private $lastName;
78

79
    /**
80
     * @var int
81
     *
82
     * @ORM\Column(type="smallint", options={"default": 3, "comment":"1: male, 2: female, 3: n/a"})
83
     */
84
    private $gender = self::UNKNOWN;
85

86
    /**
87
     * @var string|null
88
     *
89
     * @ORM\Column(type="string", length=64, nullable=true)
90
     */
91
    private $email;
92

93
    /**
94
     * @var string|null
95
     *
96
     * @ORM\Column(type="text", length=65535, nullable=true)
97
     */
98
    private $avatar;
99

100
    /**
101
     * @var string
102
     *
103
     * @ORM\Column(type="text", length=65535)
104
     */
105
    private $rawData;
106

107
    /**
108
     * @var DateTime
109
     *
110
     * @ORM\Column(type="milliseconds_dt", options={"default": "CURRENT_TIMESTAMP(3)"})
111
     */
112
    private $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
     */
120
    protected $trackingAgent;
121

122
    /**
123
     * @var string|null
124
     *
125
     * @ORM\Column(name="ip_addr", type="string", length=15, nullable=true)
126
     */
127
    protected $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
     */
135
    private $geoLocation;
136

137
    public function __construct()
138
    {
139
        $this->timeCreated = new DateTime();
140
    }
141

142
    public function getId(): ?int
143
    {
144
        return $this->id;
145
    }
146

147
    public function getExternalId(): string
148
    {
149
        return $this->externalId;
150
    }
151

152
    public function setExternalId(string $externalId): self
153
    {
154
        $this->externalId = $externalId;
155

156
        return $this;
157
    }
158

159
    public function getDataProvider(): string
160
    {
161
        return $this->dataProvider;
162
    }
163

164
    public function setDataProvider(string $dataProvider): self
165
    {
166
        $this->dataProvider = $dataProvider;
167

168
        return $this;
169
    }
170

171
    public function getUser(): User
172
    {
173
        return $this->user;
174
    }
175

176
    public function setUser(User $user): self
177
    {
178
        $this->user = $user;
179

180
        return $this;
181
    }
182

183
    public function getUsername(): ?string
184
    {
185
        return $this->username;
186
    }
187

188
    public function setUsername(?string $username): self
189
    {
190
        $this->username = $username;
191

192
        return $this;
193
    }
194

195
    public function getDisplayName(): ?string
196
    {
197
        return $this->displayName;
198
    }
199

200
    public function setDisplayName(?string $displayName): self
201
    {
202
        $this->displayName = $displayName;
203

204
        return $this;
205
    }
206

207
    public function getFirstName(): ?string
208
    {
209
        return $this->firstName;
210
    }
211

212
    public function setFirstName(?string $firstName): self
213
    {
214
        $this->firstName = $firstName;
215

216
        return $this;
217
    }
218

219
    public function getLastName(): ?string
220
    {
221
        return $this->lastName;
222
    }
223

224
    public function setLastName(?string $lastName): self
225
    {
226
        $this->lastName = $lastName;
227

228
        return $this;
229
    }
230

231
    public function getGender(): int
232
    {
233
        return $this->gender;
234
    }
235

236
    public function setGender(int $gender): self
237
    {
238
        $this->gender = $gender;
239

240
        return $this;
241
    }
242

243
    public function getEmail(): ?string
244
    {
245
        return $this->email;
246
    }
247

248
    public function setEmail(?string $email): self
249
    {
250
        $this->email = $email;
251

252
        return $this;
253
    }
254

255
    public function getAvatar(): ?string
256
    {
257
        return $this->avatar;
258
    }
259

260
    public function setAvatar(?string $avatar): self
261
    {
262
        $this->avatar = $avatar;
263

264
        return $this;
265
    }
266

267
    public function getRawData(): string
268
    {
269
        return $this->rawData;
270
    }
271

272
    public function setRawData(string $rawData): self
273
    {
274
        $this->rawData = $rawData;
275

276
        return $this;
277
    }
278

279
    public function getTimeCreated(): DateTime
280
    {
281
        return $this->timeCreated;
282
    }
283

284
    public function setTimeCreated(DateTime $timeCreated): self
285
    {
286
        $this->timeCreated = $timeCreated;
287

288
        return $this;
289
    }
290

291
    public function getTrackingAgent(): ?TrackingAgent
292
    {
293
        return $this->trackingAgent;
294
    }
295

296
    public function setTrackingAgent(TrackingAgent $trackingAgent = null): self
297
    {
298
        $this->trackingAgent = $trackingAgent;
299

300
        return $this;
301
    }
302

303
    public function getIpAddress(): string
304
    {
305
        return $this->ipAddress;
306
    }
307

308
    public function setIpAddress(string $ipAddress): self
309
    {
310
        $this->ipAddress = $ipAddress;
311

312
        return $this;
313
    }
314

315
    public function getGeoLocation(): ?GeoLocation
316
    {
317
        return $this->geoLocation;
318
    }
319

320
    public function setGeoLocation(GeoLocation $geoLocation = null): self
321
    {
322
        $this->geoLocation = $geoLocation;
323

324
        return $this;
325
    }
326
}
327

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.