zend-blog-3-backend
409 строк · 6.4 Кб
1<?php
2
3namespace App\Entity;
4
5use App\Entity\Traits\Gravatar;
6use DateTime;
7use Doctrine\Common\Collections\ArrayCollection;
8use Doctrine\Common\Collections\Collection;
9use Doctrine\ORM\Mapping as ORM;
10
11/**
12* @ORM\Table(name="v_comments")
13* @ORM\Entity(readOnly=true, repositoryClass="App\Repository\ViewCommentRepository")
14*/
15class ViewComment implements CommentInterface
16{
17use Gravatar;
18
19/**
20* @var int
21*
22* @ORM\Id
23* @ORM\Column(type="integer")
24*/
25protected $id;
26
27/**
28* @var Collection
29*
30* @ORM\OneToMany(targetEntity="ViewComment", mappedBy="parent")
31**/
32protected $children;
33
34/**
35* @ORM\ManyToOne(targetEntity="ViewComment", inversedBy="children")
36* @ORM\JoinColumn()
37**/
38protected $parent;
39
40/**
41* @var Post
42*
43* @ORM\ManyToOne(targetEntity="Post")
44*/
45protected $post;
46
47/**
48* @var string
49*
50* @ORM\Column(name="uid", type="integer")
51*/
52protected $virtualUserId;
53
54/**
55* @var string
56*
57* @ORM\Column(type="string", length=80)
58*/
59protected $username;
60
61/**
62* @var string
63*
64* @ORM\Column(name="mail", type="string", length=80, nullable=true)
65*/
66protected $email;
67
68/**
69* @var string
70*
71* @ORM\Column(type="string", length=160, nullable=true)
72*/
73protected $website;
74
75/**
76* @var string
77*
78* @ORM\Column(type="text")
79*/
80protected $text;
81
82/**
83* @var string
84*
85* @ORM\Column(name="ip_addr", type="string", length=15, nullable=true)
86*/
87protected $ipAddress;
88
89/**
90* @var string
91*
92* @ORM\Column(type="string", length=128)
93*/
94protected $city;
95
96/**
97* @var string
98*
99* @ORM\Column(type="string", length=128)
100*/
101protected $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*/
110protected $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*/
118protected $code;
119
120/**
121* @var float
122*
123* @ORM\Column(type="float")
124*/
125protected $latitude;
126
127/**
128* @var float
129*
130* @ORM\Column(type="float")
131*/
132protected $longitude;
133
134/**
135* @var string
136*
137* @ORM\Column(type="string", length=8)
138*/
139protected $timeZone;
140
141/**
142* @var bool
143*
144* @ORM\Column(type="boolean")
145*/
146protected $deleted = false;
147
148/**
149* @var DateTime
150*
151* @ORM\Column(type="milliseconds_dt")
152*/
153protected $timeCreated;
154
155/**
156* @var int
157*
158* @ORM\Column(type="smallint")
159*/
160private $gender = User::MALE;
161
162/**
163* @var string
164*
165* @ORM\Column(type="text", length=65000)
166*/
167protected $userAgent;
168
169/**
170* @var bool
171*
172* @ORM\Column(type="boolean", name="is_bot")
173*/
174protected $bot = false;
175
176/**
177* @var int
178*
179* @ORM\Column(type="smallint")
180*/
181private $avatarVariant = 0;
182
183public function __construct()
184{
185$this->children = new ArrayCollection();
186$this->timeCreated = new DateTime();
187}
188
189/**
190* Get id
191*
192* @return int
193*/
194public function getId(): ?int
195{
196return $this->id;
197}
198
199/**
200* Get virtualUserId
201*
202* @return int
203*/
204public function getVirtualUserId()
205{
206return $this->virtualUserId;
207}
208
209/**
210* Get username
211*
212* @return string
213*/
214public function getUsername(): string
215{
216return $this->username;
217}
218
219/**
220* Get email
221*
222* @return string
223*/
224public function getEmail()
225{
226return $this->email;
227}
228
229/**
230* Get website
231*
232* @return string
233*/
234public function getWebsite()
235{
236return $this->website;
237}
238
239/**
240* Get text
241*
242* @return string
243*/
244public function getText(): string
245{
246return $this->text;
247}
248
249/**
250* Get ipAddress
251*
252* @return string
253*/
254public function getIpAddress()
255{
256return $this->ipAddress;
257}
258
259/**
260* Get city
261*
262* @return string
263*/
264public function getCity()
265{
266return $this->city;
267}
268
269/**
270* Get region
271*
272* @return string
273*/
274public function getRegion()
275{
276return $this->region;
277}
278
279/**
280* Get country
281*
282* @return string
283*/
284public function getCountry()
285{
286return $this->country;
287}
288
289/**
290* Get code
291*
292* @return string|null
293*/
294public function getCode(): ?string
295{
296return $this->code;
297}
298
299/**
300* Is deleted
301*
302* @return bool
303*/
304public function isDeleted(): bool
305{
306return $this->deleted;
307}
308
309/**
310* Get timeCreated
311*
312* @return DateTime
313*/
314public function getTimeCreated()
315{
316return $this->timeCreated;
317}
318
319/**
320* Get children
321*
322* @return Collection
323*/
324public function getChildren()
325{
326return $this->children;
327}
328
329/**
330* Get parent
331*
332* @return ViewComment
333*/
334public function getParent()
335{
336return $this->parent;
337}
338
339/**
340* Get post
341*
342* @return Post
343*/
344public function getPost()
345{
346return $this->post;
347}
348
349/**
350* Get latitude
351*
352* @return float
353*/
354public function getLatitude()
355{
356return $this->latitude;
357}
358
359/**
360* Get longitude
361*
362* @return float
363*/
364public function getLongitude()
365{
366return $this->longitude;
367}
368
369/**
370* Get timeZone
371*
372* @return string
373*/
374public function getTimeZone()
375{
376return $this->timeZone;
377}
378
379/**
380* @return int
381*/
382public function getGender(): int
383{
384return $this->gender;
385}
386
387/**
388* Get userAgent
389*
390* @return string
391*/
392public function getUserAgent()
393{
394return $this->userAgent;
395}
396
397/**
398* @return bool
399*/
400public function isBot(): bool
401{
402return $this->bot;
403}
404
405public function getAvatarVariant(): int
406{
407return $this->avatarVariant;
408}
409}
410