zend-blog-3-backend

Форк
0
/
ViewComment.php 
409 строк · 6.4 Кб
1
<?php
2

3
namespace App\Entity;
4

5
use App\Entity\Traits\Gravatar;
6
use DateTime;
7
use Doctrine\Common\Collections\ArrayCollection;
8
use Doctrine\Common\Collections\Collection;
9
use Doctrine\ORM\Mapping as ORM;
10

11
/**
12
 * @ORM\Table(name="v_comments")
13
 * @ORM\Entity(readOnly=true, repositoryClass="App\Repository\ViewCommentRepository")
14
 */
15
class ViewComment implements CommentInterface
16
{
17
    use Gravatar;
18

19
    /**
20
     * @var int
21
     *
22
     * @ORM\Id
23
     * @ORM\Column(type="integer")
24
     */
25
    protected $id;
26

27
    /**
28
     * @var Collection
29
     *
30
     * @ORM\OneToMany(targetEntity="ViewComment", mappedBy="parent")
31
     **/
32
    protected $children;
33

34
    /**
35
     * @ORM\ManyToOne(targetEntity="ViewComment", inversedBy="children")
36
     * @ORM\JoinColumn()
37
     **/
38
    protected $parent;
39

40
    /**
41
     * @var Post
42
     *
43
     * @ORM\ManyToOne(targetEntity="Post")
44
     */
45
    protected $post;
46

47
    /**
48
     * @var string
49
     *
50
     * @ORM\Column(name="uid", type="integer")
51
     */
52
    protected $virtualUserId;
53

54
    /**
55
     * @var string
56
     *
57
     * @ORM\Column(type="string", length=80)
58
     */
59
    protected $username;
60

61
    /**
62
     * @var string
63
     *
64
     * @ORM\Column(name="mail", type="string", length=80, nullable=true)
65
     */
66
    protected $email;
67

68
    /**
69
     * @var string
70
     *
71
     * @ORM\Column(type="string", length=160, nullable=true)
72
     */
73
    protected $website;
74

75
    /**
76
     * @var string
77
     *
78
     * @ORM\Column(type="text")
79
     */
80
    protected $text;
81

82
    /**
83
     * @var string
84
     *
85
     * @ORM\Column(name="ip_addr", type="string", length=15, nullable=true)
86
     */
87
    protected $ipAddress;
88

89
    /**
90
     * @var string
91
     *
92
     * @ORM\Column(type="string", length=128)
93
     */
94
    protected $city;
95

96
    /**
97
     * @var string
98
     *
99
     * @ORM\Column(type="string", length=128)
100
     */
101
    protected $region;
102

103
    /**
104
     * Country name based on ISO 3166.
105
     *
106
     * @var string
107
     *
108
     * @ORM\Column(name="country_name", type="string", length=64)
109
     */
110
    protected $country;
111

112
    /**
113
     * Two-character country code based on ISO 3166.
114
     *
115
     * @var string
116
     * @ORM\Column(name="country_code", type="string", length=2, unique=true)
117
     */
118
    protected $code;
119

120
    /**
121
     * @var float
122
     *
123
     * @ORM\Column(type="float")
124
     */
125
    protected $latitude;
126

127
    /**
128
     * @var float
129
     *
130
     * @ORM\Column(type="float")
131
     */
132
    protected $longitude;
133

134
    /**
135
     * @var string
136
     *
137
     * @ORM\Column(type="string", length=8)
138
     */
139
    protected $timeZone;
140

141
    /**
142
     * @var bool
143
     *
144
     * @ORM\Column(type="boolean")
145
     */
146
    protected $deleted = false;
147

148
    /**
149
     * @var DateTime
150
     *
151
     * @ORM\Column(type="milliseconds_dt")
152
     */
153
    protected $timeCreated;
154

155
    /**
156
     * @var int
157
     *
158
     * @ORM\Column(type="smallint")
159
     */
160
    private $gender = User::MALE;
161

162
    /**
163
     * @var string
164
     *
165
     * @ORM\Column(type="text", length=65000)
166
     */
167
    protected $userAgent;
168

169
    /**
170
     * @var bool
171
     *
172
     * @ORM\Column(type="boolean", name="is_bot")
173
     */
174
    protected $bot = false;
175

176
    /**
177
     * @var int
178
     *
179
     * @ORM\Column(type="smallint")
180
     */
181
    private $avatarVariant = 0;
182

183
    public function __construct()
184
    {
185
        $this->children = new ArrayCollection();
186
        $this->timeCreated = new DateTime();
187
    }
188

189
    /**
190
     * Get id
191
     *
192
     * @return int
193
     */
194
    public function getId(): ?int
195
    {
196
        return $this->id;
197
    }
198

199
    /**
200
     * Get virtualUserId
201
     *
202
     * @return int
203
     */
204
    public function getVirtualUserId()
205
    {
206
        return $this->virtualUserId;
207
    }
208

209
    /**
210
     * Get username
211
     *
212
     * @return string
213
     */
214
    public function getUsername(): string
215
    {
216
        return $this->username;
217
    }
218

219
    /**
220
     * Get email
221
     *
222
     * @return string
223
     */
224
    public function getEmail()
225
    {
226
        return $this->email;
227
    }
228

229
    /**
230
     * Get website
231
     *
232
     * @return string
233
     */
234
    public function getWebsite()
235
    {
236
        return $this->website;
237
    }
238

239
    /**
240
     * Get text
241
     *
242
     * @return string
243
     */
244
    public function getText(): string
245
    {
246
        return $this->text;
247
    }
248

249
    /**
250
     * Get ipAddress
251
     *
252
     * @return string
253
     */
254
    public function getIpAddress()
255
    {
256
        return $this->ipAddress;
257
    }
258

259
    /**
260
     * Get city
261
     *
262
     * @return string
263
     */
264
    public function getCity()
265
    {
266
        return $this->city;
267
    }
268

269
    /**
270
     * Get region
271
     *
272
     * @return string
273
     */
274
    public function getRegion()
275
    {
276
        return $this->region;
277
    }
278

279
    /**
280
     * Get country
281
     *
282
     * @return string
283
     */
284
    public function getCountry()
285
    {
286
        return $this->country;
287
    }
288

289
    /**
290
     * Get code
291
     *
292
     * @return string|null
293
     */
294
    public function getCode(): ?string
295
    {
296
        return $this->code;
297
    }
298

299
    /**
300
     * Is deleted
301
     *
302
     * @return bool
303
     */
304
    public function isDeleted(): bool
305
    {
306
        return $this->deleted;
307
    }
308

309
    /**
310
     * Get timeCreated
311
     *
312
     * @return DateTime
313
     */
314
    public function getTimeCreated()
315
    {
316
        return $this->timeCreated;
317
    }
318

319
    /**
320
     * Get children
321
     *
322
     * @return Collection
323
     */
324
    public function getChildren()
325
    {
326
        return $this->children;
327
    }
328

329
    /**
330
     * Get parent
331
     *
332
     * @return ViewComment
333
     */
334
    public function getParent()
335
    {
336
        return $this->parent;
337
    }
338

339
    /**
340
     * Get post
341
     *
342
     * @return Post
343
     */
344
    public function getPost()
345
    {
346
        return $this->post;
347
    }
348

349
    /**
350
     * Get latitude
351
     *
352
     * @return float
353
     */
354
    public function getLatitude()
355
    {
356
        return $this->latitude;
357
    }
358

359
    /**
360
     * Get longitude
361
     *
362
     * @return float
363
     */
364
    public function getLongitude()
365
    {
366
        return $this->longitude;
367
    }
368

369
    /**
370
     * Get timeZone
371
     *
372
     * @return string
373
     */
374
    public function getTimeZone()
375
    {
376
        return $this->timeZone;
377
    }
378

379
    /**
380
     * @return int
381
     */
382
    public function getGender(): int
383
    {
384
        return $this->gender;
385
    }
386

387
    /**
388
     * Get userAgent
389
     *
390
     * @return string
391
     */
392
    public function getUserAgent()
393
    {
394
        return $this->userAgent;
395
    }
396

397
    /**
398
     * @return bool
399
     */
400
    public function isBot(): bool
401
    {
402
        return $this->bot;
403
    }
404

405
    public function getAvatarVariant(): int
406
    {
407
        return $this->avatarVariant;
408
    }
409
}
410

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

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

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

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