zend-blog-3-backend
314 строк · 5.4 Кб
1<?php
2
3namespace App\Entity;4
5use DateTime;6use Doctrine\ORM\Mapping as ORM;7
8/**
9* @ORM\Table(name="tracking")
10* @ORM\Entity(repositoryClass="App\Repository\TrackingRepository")
11*/
12class Tracking13{
14/**15* @var int
16*
17* @ORM\Id
18* @ORM\Column(type="integer")
19* @ORM\GeneratedValue(strategy="AUTO")
20*/
21protected $id;22
23/**24* @var \App\Entity\Post
25*
26* @ORM\ManyToOne(targetEntity="Post")
27* @ORM\JoinColumn(onDelete="CASCADE")
28*/
29protected $post;30
31/**32* @var \App\Entity\TrackingAgent
33*
34* @ORM\ManyToOne(targetEntity="TrackingAgent", inversedBy="trackings")
35* @ORM\JoinColumn(name="user_agent_id", referencedColumnName="id", onDelete="SET NULL")
36*/
37protected $trackingAgent;38
39/**40* @var string
41*
42* @ORM\Column(name="ip_addr", type="string", length=15, nullable=true)
43*/
44protected $ipAddress;45
46/**47* @var GeoLocation
48*
49* @ORM\ManyToOne(targetEntity="GeoLocation")
50* @ORM\JoinColumn(name="ip_long", referencedColumnName="ip_long", onDelete="SET NULL")
51*/
52private $geoLocation;53
54/**55* @var DateTime
56*
57* @ORM\Column(type="milliseconds_dt")
58*/
59protected $timeCreated;60
61/**62* @var bool
63*
64* @ORM\Column(name="is_cdn", type="boolean", options={"default": false})
65*/
66private $cdn;67
68/**69* @var string|null
70*
71* @ORM\Column(type="string", length=128, nullable=true)
72*/
73private $requestURI;74
75/**76* @var int|null
77*
78* @ORM\Column(type="smallint", nullable=true)
79*/
80private $statusCode;81
82/**83* @var int
84*
85* @ORM\Column(type="integer", options={"unsigned": true, "default": 0})
86*/
87private $duration = 0;88
89/**90* @var string|null
91*
92* @ORM\Column(type="string", length=8, nullable=true)
93*/
94private $method;95
96public function __construct()97{98$this->cdn = false;99
100$this->setTimeCreated(new DateTime());101}102
103/**104* Get id
105*
106* @return int
107*/
108public function getId()109{110return $this->id;111}112
113/**114* Set ipAddress
115*
116* @param string $ipAddress
117*
118* @return Tracking
119*/
120public function setIpAddress($ipAddress)121{122$this->ipAddress = $ipAddress;123
124return $this;125}126
127/**128* Get ipAddress
129*
130* @return string
131*/
132public function getIpAddress()133{134return $this->ipAddress;135}136
137/**138* Set timeCreated
139*
140* @param DateTime $timeCreated
141*
142* @return Tracking
143*/
144public function setTimeCreated(DateTime $timeCreated)145{146$this->timeCreated = $timeCreated;147
148return $this;149}150
151/**152* Get timeCreated
153*
154* @return DateTime
155*/
156public function getTimeCreated()157{158return $this->timeCreated;159}160
161/**162* Set trackingAgent
163*
164* @param TrackingAgent $trackingAgent
165*
166* @return Tracking
167*/
168public function setTrackingAgent(TrackingAgent $trackingAgent = null)169{170$this->trackingAgent = $trackingAgent;171
172return $this;173}174
175/**176* Get trackingAgent
177*
178* @return TrackingAgent
179*/
180public function getTrackingAgent()181{182return $this->trackingAgent;183}184
185/**186* Set post
187*
188* @param Post $post
189*
190* @return Tracking
191*/
192public function setPost(Post $post = null)193{194$this->post = $post;195
196return $this;197}198
199/**200* Get post
201*
202* @return Post
203*/
204public function getPost()205{206return $this->post;207}208
209/**210* @return bool
211*/
212public function isCdn(): bool213{214return $this->cdn;215}216
217/**218* @param bool $cdn
219*
220* @return Tracking
221*/
222public function setCdn(bool $cdn): Tracking223{224$this->cdn = $cdn;225
226return $this;227}228
229/**230* @return string|null
231*/
232public function getRequestURI(): ?string233{234return $this->requestURI;235}236
237/**238* @param string|null $requestURI
239*
240* @return Tracking
241*/
242public function setRequestURI(string $requestURI = null): self243{244$this->requestURI = $requestURI;245
246return $this;247}248
249/**250* @return int|null
251*/
252public function getStatusCode(): ?int253{254return $this->statusCode;255}256
257/**258* @param int|null $statusCode
259*
260* @return Tracking
261*/
262public function setStatusCode(int $statusCode = null): self263{264$this->statusCode = $statusCode;265
266return $this;267}268
269/**270* Get geoLocation
271*
272* @return GeoLocation|null
273*/
274public function getGeoLocation(): ?GeoLocation275{276return $this->geoLocation;277}278
279/**280* @param GeoLocation|null $location
281*
282* @return $this
283*/
284public function setGeoLocation(GeoLocation $location = null): self285{286$this->geoLocation = $location;287
288return $this;289}290
291public function getDuration(): int292{293return $this->duration;294}295
296public function setDuration(int $duration): self297{298$this->duration = $duration;299
300return $this;301}302
303public function getMethod(): ?string304{305return $this->method;306}307
308public function setMethod(string $method = null): self309{310$this->method = $method;311
312return $this;313}314}
315